CSS – установка фиксированной ширины в пикселях рядом со свойством max-width ⇐ CSS
-
Anonymous
CSS – установка фиксированной ширины в пикселях рядом со свойством max-width
I have a div which contains a tag. The div is a container for a message text. The div should have a width of 200px, and also a max-width of 600px so that if the message is longer, the div can grow up to 600px. When implementing this, the width stays at 200px and the text overflows the div instead of the div growing in size (up to 600px)
Here is the code:
{message.messageText}
const styles = { // styles for the div messageBubbleWrapper: { width: 200, maxWidth: 500, padding: 10, borderRadius: 10, height: "auto", maxHeight: 300, margin: "35px 0 20px 0", }, }
I have also changed the width property of the messageBubbleWrapper to 30% (30% of the parent div which is set to 100% width) after researching solutions, however this just sets the width to 30% even if the text is large and overflows the div. Any solutions? Thanks.
Источник: https://stackoverflow.com/questions/780 ... h-property
I have a div which contains a tag. The div is a container for a message text. The div should have a width of 200px, and also a max-width of 600px so that if the message is longer, the div can grow up to 600px. When implementing this, the width stays at 200px and the text overflows the div instead of the div growing in size (up to 600px)
Here is the code:
{message.messageText}
const styles = { // styles for the div messageBubbleWrapper: { width: 200, maxWidth: 500, padding: 10, borderRadius: 10, height: "auto", maxHeight: 300, margin: "35px 0 20px 0", }, }
I have also changed the width property of the messageBubbleWrapper to 30% (30% of the parent div which is set to 100% width) after researching solutions, however this just sets the width to 30% even if the text is large and overflows the div. Any solutions? Thanks.
Источник: https://stackoverflow.com/questions/780 ... h-property
Мобильная версия