CSS3 Text Effects


CSS3 contains several new text features.

In this chapter you will learn about the following text properties:

  • text-shadow
  • word-wrap

Note :

Internet Explorer does not yet support the text-shadow property.

Firefox, Chrome, Safari, and Opera support the text-shadow property.

All major browsers support the word-wrap property.

CSS3 Text Shadow

In CSS3, the text-shadow property applies shadow to text.

text_shadow_effect

You specify the horizontal shadow, the vertical shadow, the blur distance, and the color of the shadow:

Example

Add a shadow to a header:

h1
{
text-shadow: 5px 5px 5px #FF0000;
}

CSS3 Word Wrapping

If a word is too long to fit within an area, it expands outside:

In CSS3, the word-wrap property allows you to force the text to wrap – even if it means splitting it in the middle of a word:

The CSS code is as follows:

Example

Allow long words to be able to break and wrap onto the next line:

p {word-wrap:break-word;}