HTML and CSS Reference
In-Depth Information
The <head>
First, the DOCTYPE:
<!doctype html>
That's it. No URLs that even the most prolifi c web authors need
to cut and paste. Note that there is no version number. That's
all. It's not so much an instruction as an incantation: it's required
by browsers that need the presence of a doctype to trigger
standards mode, and this string is the shortest string that does
this reliably.
Then we need to defi ne the document's character encoding.
Not doing so can result in an obscure but real security risk (see
http://code.google.com/p/doctype/wiki/ArticleUtf7 ). This should
be in the fi rst 512 bytes of the document. Unless you can think
of a splendid reason not to use it, we recommend UTF-8 as the
character encoding:
<!doctype html>
<meta charset=utf-8>
Ta k e a l o o k a t t h a t <meta> tag very carefully. Those who are
used to writing XHTML will notice three oddities. The fi rst is
that the <meta> tag is much shorter than that we have used
up until now—we've been used to using <meta http-equiv=
”Content-Type” content=”text/html; charset=UTF-8”> . This is
still possible, but the shorter way is preferred as it's easier to
type and works everywhere already.
Yo u ' l l a l s o n o t i c e t h a t I h a v e n ' t q u o t e d t h e a t t r i b u t e
charset=”utf-8” . Neither have I self-closed the tag
<meta charset=utf-8 /> .
HTML5 is not an XML language, so you don't need to do those
things. But you can if you prefer. All of these are equally valid
HTML5:
<META CHARSET=UTF-8>
<META CHARSET=UTF-8 />
<META CHARSET=”UTF-8”>
<META CHARSET=”UTF-8” />
<meta charset=utf-8>
<meta charset=utf-8 />
<meta charset=”utf-8”>
<meta charset=”utf-8” />
<MeTa CHARset=utF-8>
 
 
Search WWH ::




Custom Search