04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with 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.

We can’t have your pages putting<br />

the browser into Quirks Mode!<br />

We’ll all be better off for telling the browser up front: “Hey, we’re<br />

an <strong>HTML</strong> page that gets it. We’re standards compliant. This is<br />

<strong>HTML</strong> 4.01, baby!”<br />

When you do that, the browser knows exactly how to handle your<br />

page and (at least on any browser you’d care about) the page is<br />

going to display as you’d expect.<br />

So, how do you tell the browser? Easy, you just add one line to the<br />

top of your <strong>HTML</strong> files. Here’s what the line looks like:<br />

Okay, we know that is one butt ugly line, but keep in mind, it is<br />

written for your browser, not you. This line is called a document type<br />

definition because it tells the browser the type of the document, and in<br />

this case, the document is your <strong>HTML</strong> page. Let’s just take a quick<br />

peek at this line to get a feel for it. But again, this is browser speak,<br />

not something you need to know well or memorize. Just throw it in<br />

the top of your <strong>HTML</strong> and you’re ready to go.<br />

Tells the browser this is<br />

specifying a document<br />

standards, compliance, and all that jazz<br />

<br />

This means<br />

that <br />

is the root<br />

(first) element<br />

in your page.<br />

type for this page.You can type this all on<br />

<br />

Notice that this is NOT an <strong>HTML</strong><br />

element. It has a “!” after the “

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

Saved successfully!

Ooh no, something went wrong!