HTML and CSS Reference
In-Depth Information
Try iT
In this Try It you learn how to center text.
Lesson requirements
You will need your previously saved file
thoreau.html
, a text editor, and a web browser.
step-by-step
1.
Open your text editor.
2.
Open the previously saved
thoreau.html
.
3.
Place your cursor at the end of the
h1
,
h2
CSS rule and press Enter (Return).
4.
Enter the following code:
h2 { text-align: center; }
5.
Save your page.
6.
View
thoreau.html
in your browser to view the alignment change, as shown in Figure 7-6.
FiGure 7-6
Please select a video from Lesson 7 on the DVD with the print topic, or watch
➤
➤
Specifying a font-family
Setting the font size and spacing in a paragraph
➤
➤
➤
➤
Defining text color
➤
➤
Centering text