HTML and CSS Reference
In-Depth Information
77 7
Save your page.
View thoreau.html in your browser to view the color changes, as shown in Figure 7-5.
(Note: This igure is in grayscale in the topic so you will only notice a shading difference
here. The color will be fully visible on your own computer when you run this example.)
FiGure 7-5
aLiGninG and eMPHasizinG TeXT
You can easily align headings and paragraphs to the left, right, and center with CSS through the
text-align property. Paragraphs can also be justified so that the text goes to both the left and right
margins. To align text, create a CSS declaration like this:
text-align: center;
In addition to center , the other acceptable values are left , right , and justify .
When a browser applies a defined CSS alignment, it takes the width of the containing element into
account as well as any relevant margins or paddings.
You can bring attention to text in numerous ways. Two of the most commonly used HTML tags are
<em> and <strong> . Content within an <em> tag, short for emphasis, is typically rendered as italic
text. Text in a <strong> tag is typically bolded. You're free to modify the default stylings by adding
your own characteristics to a CSS rule for em or
strong .
Beginning web designers often wonder why there is no tag for underlining text,
which is a typical method of emphasizing text in the print world. In earlier ver-
sions of HTML, there was a <u> tag, but the resulting text was quickly found
to be easily confused with links, which are underlined by default. The <u> tag is
obsolete in HTML5. Instead, you can use the text-decoration property set to
an underline value to achieve the same results in a CSS rule.
Search WWH ::

Custom Search