skip to content
Advertise here

CSS3 - Text Overflow

23rd April 2010

Method One - Using text-overflow: ellipsis;

Beatles Records



Method Two - Using an image to indicate text-overflow

Beatles Records



For further information on text-overflow see the W3.org specification - CSS3 'text-overflow'

CSS play Support


CSS play Recommend

Free, practical CSS menus, layouts, and examples

Follow CSS play

Facebook  Twitter  Facebook Fan Page



Just CSS | Designs for the future

Like the CSS Zen Garden?
Then why not visit Just CSS and see it you can design for the future.




Information

This demonstration is produced in collaboration with Román Cortés

Sometimes it is necessary to truncate lines of text so that they fit within a set size of box and using the 'text-overflow' style the extra text can be made to show on hover.

The text-overflow:ellipsis; style is supported by all modern browsers including IE6, IE7 and IE8 so the first demo shows the 'ellipsis' three dots to indicate extra text (except in Firefox) and hovering over the text will show the missing text.

However, we thought that it would be nice to be able to indicate extra text using a small graphic so the second demonstration has the same unordered list but with slightly different code and styling so that if the text has an overflow then the graphic is added, but if there is no overflow then there will be no visible graphic. This also works in all modern browsers including IE6, IE7 and IE8.

Tested in IE6, IE7, IE8, Firefox, Opera and Safari(PC) and Chrome.




Copyright

You may use this method on your personal 'non-profit' web site without seeking my permission. A link back to CSSplay is always appreciated.

Commercial usage is also permitted without seeking approval, but I would ask that a donation is considered to support my work on CSSPlay.

If you are having problems integrating any of my demonstrations into your website then I now offer a service to fault find and correct any errors that you may have introduced. Please email me for more information.




  • Each week the Creare Group produce video tutorials for SEO and tips and tricks for the web design industry.
  • We offer nothing but the highest quality SEO, Social Media Optimisation And PPC services to businesses in London

 

CSS play Testimonial

"The citroen.co.uk web site uses
CSS play code for the site drop down menus.
This code works seamlessly in IE 6 & 7, and is an excellent solution to the Creative requirements of the site."

Damon Clark - Brandwidth