CSS3 introduces new properties for text effect. This tutorial presents these CSS3 text properties: the text-shadow, word-wrap, and text-overflow.

CSS3 text-shadow

The text-shadow property introduced in CSS3 allows for one or more shadow effects to be applied to the text of an element. This shadow is drawn around the letters.
text-shadow: offset_X offset_Y blur color;
- offset_X - specifies the position of the horizontal shadow. Negative values are allowed.
- offset_Y - specifies the position of the vertical shadow. Negative values are allowed.
- blur - sets the blur distance (optional).
- color - defines the color of the shadow (optional). If it is not specified is set to black.

h2 {
 text-shadow: 2px 3px 3px #a0a1fe;

<h4>Example text-shadow</h4>

<h2>Text with text-shadow</h2>
You can add multiple shadows on the same element, by adding the list of shadows separated by comma, in the text-shadow property.
Multiple shadows are drawn front (first shadow listed) to back (last shadow).
The following code mixes a color of green and a color of blue to create a text-shadow effect.

The rgba(Red, Green, Blue, Alpha) formula is used to define the colors, adding transparency (Alpha) in the same time.

h2 {
 text-shadow: -1px -1px 1px rgba(110,235,155,0.2), 2px 3px rgba(0,0,181,0.2);

<h4>Example multiple text-shadow</h4>

<h2>Text with two colors for text-shadow</h2>

CSS3 word-wrap

With word-wrap you can allow browsers to break lines in the middle of words to prevent long strings of characters from overflowing a box.
word-wrap: value;
'value' can be:
- normal - Single words cannot be broken (default).
- break-word - Allows unbreakable words to be broken. Words are broken by character, not syllables, and are not hyphenated.

#id1 {
 border:1px solid blue;

<h4>Example word-wrap</h4>

<div id='id1'>Free CSS Course - word-wrap some_looonnng_word.</div>

CSS3 text-overflow

With text-overflow property you can specifies what should happen when text overflows the containing element.
text-overflow: value;
'value' can be:
- clip - clips the text (default).
- ellipsis - render an ellipsis ('…') to represent clipped text.

• Usualy, the text-overflow is used together with white-space:nowrap; and overflow:hidden;.

#id1 {
 border:1px solid blue;
 overflow:hidden; /* 'overflow' value must be different from 'visible' */
#id2 {
 border:1px solid green;

#id1:hover, #id2:hover {

<h4>Example text-overflow</h4>
<p>Place mouse-cursor over texts bellow.</p>

<div id='id1'>CSS Tutorial - some long text in a line, any good words.</div>
<div id='id2'>Web site coursesweb.net - another long text in a line.</div>

Daily Test with Code Example

Which HTML5 tag can be used to embed an external application (SWF, PDF) in web page?
<mark> <embed> <canvas>
<embed src="flash_game.swf" width="450" height="350" />
Which CSS pseudo-element adds a special style to the first line of a text?
:first-letter :before :first-line
#id:first-line {
  font-weight: bold;
  color: blue;
Click on the window object property which gets or sets the URL of current page.
window.location window.self window.status
var url = window.location;
Indicate the PHP function used to get the contents of a file or page and store it into a string.
fopen() file_put_contents() file_get_contents()
$homepage = file_get_contents("http://coursesweb.net/");
echo $homepage;
CSS3 - text-shadow, word-wrap, text-overflow

Last accessed pages

  1. Dynamic variables in JavaScript (11026)
  2. AJAX Course, free Lessons (7825)
  3. Read Excel file data in PHP - PhpExcelReader (72071)
  4. Circle and Oval with CSS (5331)
  5. Contact page - CoursesWeb (27247)

Popular pages this month

  1. Making DIV Contents Scroll Horizontally, with multiple Div`s inside (1319)
  2. Contact page - CoursesWeb (1290)
  3. Tabs effect with CSS (1287)
  4. PHP getElementById and getElementsByTagName (585)
  5. Get Attribute (ID, Class, Name, Title, Src) with jQuery (488)