CSS – установка фиксированной ширины в пикселях рядом со свойством max-widthCSS

Разбираемся в CSS
Ответить
Anonymous
 CSS – установка фиксированной ширины в пикселях рядом со свойством max-width

Сообщение Anonymous »


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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «CSS»