CSS Trick : text-overflow

I’d like to share with a css trick that I recently discovered accidently.
It’s called “text-overflow”. How many times have you created and used a script that truncate overflown statement and add “…” to the end of it?

But IE has css property, text-overflow, and it will make your life lot easier.

Here’s an example:

President Bush said for the first time on Thursday he made a “miscalculation of what the conditions would be” after U.S. troops went to Iraq.
President Bush said for the first time on Thursday he made a “miscalculation of what the conditions would be” after U.S. troops went to Iraq.

See how beautifully it truncated!

Note: you should be using <nobr> in order for text-overflow to work.

Comment are closed.