Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

The <head>

First things first: the DOCTYPE:

<!DOCTYPE html>

That’s it. No unwieldy string that even the most prolific web authors need to cut and paste. No URLs. 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 is the shortest string that does this reliably. We’ve written in uppercase so that it’s both HTML and XML compliant, and suggest you do the same.

Then we need to define 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 first 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:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint