CSS3 brings additional flexibility to web developers when working with text. For example, with CSS3, it is now easy to apply shadows to your text or handle word-wrapping and overflow of text. With regard to shadows, this eliminates the need to create a separate image that contains the text and shadow, like you would when using popular image editing software.

The text-shadow Property

The property used to apply a shadow to your selected text is text-shadow. The text-shadow property is supported in all major browsers, except Internet Explorer.

text-shadow Syntax

The text-shadow property applies shadow to text. The text-shadow property has no default value assigned to it.

text-shadow: h-shadow v-shadow blur color;

Example

You should note that the text-shadow property does support one or more shadows attached to the text. When attaching more than one shadow, separate the set of values with a comma.

Text Shadow

The word-wrap Property

The word-wrap property allows long words to be able to be broken and wrapped onto the next line. This property allows for two values; normal or break-word. The word-wrap property is supported in all major browsers.

word-wrap Syntax

The word-wrap property allows long words to be able to be broken and wrap onto the next line. The default value is normal.

word-wrap: break-word|normal;

This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.

The text-overflow Property

There may be instances where you will need for the text in the element to be clipped such as when it overflows the element’s box. When this occurs, you want to leave a visual hint to the user that text has been clipped. The text-overflow property is supported in all major browsers.

text-overflow Syntax

The text-overflow property specifies what should happen when text overflows the containing element. The default value is clip.

text-overflow: clip|ellipsis|string;

This is some long text that will not fit in the box. The text should be clipped.

This is some long text that will not fit in the box. You should see an ellipsis.