There is one problem, I can not solve. We have a block with a fixed height. For example, 280px. In this block, we have simple text, but it can be a couple of words or a couple of paragraphs. And now you need to put all the text in this block (without cutting). And if there is a lot of text, then the block should not be increased in height, but increased in width so that the text would still fit. That is, the block in any case should remain 280px in height, and in width should stretch enter image description here

I will give an example as a picture, thank you in advance.

  • The height should be fixed. In the picture, the first rectangle has a height of 280 and the second is 280, and their width is 300 and 450, respectively. That is, with a large amount of text, I have to leave a height of 280 and stretch the block in width - WebSiteCoder

1 answer 1

CSS:

max-height: 280px; min-width: 300px; max-width: 100%; 

I think no need to explain.

  • The situation is this, you need the text on the green stretched to 100%, and did not get out of the bottom of jsfiddle.net/Lctq4szr - WebSiteCoder
  • @SeregaPokofjev overflow: auto; - A scroll bar appears. overflow: hidden; - the text that climbs out of the frame will not see. - Vladislav
  • one
    This will not work. Need to write a script - Alexey Ten
  • Yes, I understand that only css is not enough here, if not difficult, tell me how to implement it on jquery - WebSiteCoder