Chapter 40. Using Text Elements Properly


Just about every Web designer has done it at one time or another: using an HTML tag to mark up some text based on how the result looks in a browser instead of what the tag is supposed to mark up. Need a quick line of bold text? Who among us hasn't been at least tempted to reach for a header tag, even if the text in question doesn't really function as a header? Need to add some whitespace? The blockquote tag does the trick, even when you aren't trying to format an offset quote.

Now that Cascading Style Sheets (CSS) have become somewhat reasonably reliable in most browsers, the old arguments for doing whatever works don't hold as much water. CSS allows any HTML element to look however you, the designer, want it to look, so you don't have to borrow a tag on the basis of its appearancewhich means that HTML tags can go back to their original purpose of defining the structure of the page. When you mark something up as a header, in other words, it really ought to function as a header on your page. When you mark something up as a blockquote, it should be an offset block of text, not an image that needs a little extra whitespace.

If you have been designing Web sites for any length of time, you may have gotten into some bad HTML habits, and you might forget exactly what HTML text tags are supposed to mark up. Enter Table 40.1.

Table 40.1. Common HTML Text Tags

TAG

IDENTIFIES

EXAMPLE

address

Your street address, phone number, email address, or other form of contact information

<address>Your address goes here</address>

blockquote

An offset quote

<blockquote>An offset quote goes here.</blockquote>

h1

First-level heading

<h1>A heading goes here</h1>

h2

Second-level heading

<h2>A heading goes here</h2>

h3

Third-level heading

<h3>A heading goes here</h3>

h4

Fourth-level heading

<h4>A heading goes here</h4>

h5

Fifth-level heading

<h5>A heading goes here</h5>

h6

Sixth-level heading

<h6>A heading goes here</h6>

p

Paragraph

<p>A paragraph goes here.</p>

q

Inline quote

<q>An inline quote goes here.</q>




Web Design Garage
Web Design Garage
ISBN: 0131481991
EAN: 2147483647
Year: 2006
Pages: 202
Authors: Marc Campbell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net