Saturday 15 May 2010

html - Limiting a div height to two lines of text inside it? -


How to limit the height of a div to one / two / n lines of text in it as a question? >

  div {height: 1em; // This is a line, 2 AM for two rows, etc ... Line-height: 1 AM; // Height of a text line overflow: hidden; }   

This will display a div with the height of the current font size, and any overflow will be cut. As long as the height and height of the line are equal, there will be a line of text. The ratio of the height / line-height determines the number of lines displayed.

No comments:

Post a Comment