How to limit length of the text

Tags: , ,

Working on a site often there is a problem to limit length of pathway or heading of article since very long text can corrupt design of page. Usually when the text turns out too long, that does not get into one line, and it is carry over to the next line. However, for some reason very few people knows, that it is possible to tune up CSS so that the long text was cut off till the certain length, and in the end was ellipsis. For this purpose it is enough to prescribe in style (an example for pathway):

.pathway { 
    width: 25em;  
 
    white-space: nowrap; 
    text-overflow: ellipsis; 
    overflow: hidden; 
}

You can change 25em to yours needs and add other attributes.

Related Posts

3 Responses to “How to limit length of the text”

  1. 1
    Rene Says:

    Thanks for the tip. Just what I needed to know :-)

  2. 2
    Jason Says:

    Where would you put this piece of code in joomla?

  3. 3
    Strands Says:

    Note this only works in IE …

You can follow any responses to this entry through the RSS 2.0 feed.

Leave a Reply