Slide 5.3: CSS background (cont.)
Slide 5.5: CSS text (cont.)
Home

CSS Text

text formatting

This text is styled with some of the text formatting properties. The heading uses the text-align, text-transform, and color properties. The paragraph is indented, aligned, and the space between characters is specified. The underline is removed from the “Check the page” link.


Text Color
The text color is set by the color property, which can be specified by: The default color for a page is defined in the body selector. For example,
   body { color:blue; }
   h1 { color:#00ff00; }
   h2 { color:rgb(255,0,0); }
Text Alignment
The text-align property is used to set the horizontal alignment of a text. Text can be centered, or aligned to the left or right, or justified. When text-align is set to “justify,” each line is stretched so that every line has equal width, and the left and right margins are straight. For example,
   h1 { text-align:center; }
   p.date { text-align:right; }
   p.main { text-align:justify; }
Text Indentation
The text-indent property is used to specify the indentation of the first line of a text, for example,
   p { text-indent:50px; }

Demonstration
The following demonstration shows how the script of HTML and CSS is displayed on the Web: