04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

using to specify a content type<br />

Adding a tag to specify the content type<br />

Most of you reading this book are probably using English or Western-European<br />

languages (the so-called “Latin” languages), so you’ll need a tag in your<br />

<strong>HTML</strong> that looks like this:<br />

<br />

You’re going to throw this line in as the first thing inside the element of your<br />

<strong>HTML</strong>. This tag tells any browser the content type of your file, and what kinds of<br />

characters are used to encode it. Let’s look at the tag in a little more detail...<br />

“meta” means we’re<br />

going to tell the<br />

browser something<br />

about the page...<br />

Just like other <strong>HTML</strong> tags, the<br />

tag has attributes.<br />

240 Chapter 6<br />

And we’re going to<br />

tell it something<br />

more about the<br />

content type of<br />

the page.<br />

The content attribute<br />

is where we specify<br />

the content type<br />

information.<br />

<br />

Q: DOCTYPES, tags... ugh, do I need to really<br />

remember all this to write Web pages?<br />

A: Specifying a DOCTYPE and a content tag<br />

are kind of like taxes: you gotta do them to be compliant. Look<br />

at it this way: you already understand them more than 99% of<br />

the Web page writing population, which is great. But at the end<br />

of the day, everyone just puts the DOCTYPE and tag in<br />

their <strong>HTML</strong> and moves on <strong>with</strong> life. So make sure you’ve got the<br />

right DOCTYPE and tag and then go do something much<br />

more fun.<br />

<strong>First</strong> we tell it that this is an <strong>HTML</strong><br />

file. This is a bit redundant, because the<br />

browser already knows that (remember we<br />

told it that in the DOCTYPE as well).<br />

there are no<br />

Dumb Questions<br />

Q: ISO-8859-1?<br />

Here’s the new part; this tells<br />

the browser that we’re using<br />

the ISO-8859-1 character<br />

encoding.<br />

Notice that this whole<br />

string is the value of the<br />

content attribute.<br />

A: Work <strong>with</strong> us here. It’s like WD-40; you don’t worry about<br />

why it’s called that, you just use it.<br />

ISO-8859-1 is the character encoding for “Latin-1” characters,<br />

which can represent almost all the European languages. If<br />

you’re writing in another language, check out the information on<br />

character encoding at<br />

http://www.w3.org/International/O-charset.html.

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

Saved successfully!

Ooh no, something went wrong!