22.04.2013 Views

HTML, XHTML & CSS

HTML, XHTML & CSS

HTML, XHTML & CSS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 5-6: Use the element to add<br />

horizontal lines to your page.<br />

Chapter 5: Text and Lists<br />

A horizontal rule always sits on a line by itself; you can’t add the element<br />

in the middle of a paragraph (or other block element) and expect the<br />

rule to appear in the middle of the block.<br />

This bit of <strong>HTML</strong> creates a horizontal rule that takes up 45 percent of the<br />

page width, is 4 pixels (px) high, is aligned to the center, and has shading<br />

turned off:<br />

This is a paragraph followed by a horizontal rule.<br />

<br />

This is a paragraph preceded by a horizontal rule.<br />

Figure 5-7 shows how adding these attributes alters how the rule is displayed.<br />

(Note: These attributes are deprecated, and are better replaced with <strong>CSS</strong><br />

equivalents as described in Chapters 9–12. Deprecated attributes are covered<br />

in Chapter 8.)<br />

Figure 5-7: Horizontal rule markup enables a<br />

browser to display a rule sized to the current<br />

page display.<br />

Figure 5-8 shows how you can use horizontal rules in the real world to highlight<br />

important content. The EdTittel.com home page uses a colored hard<br />

rule to separate the footer from the rest of the page.<br />

81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!