Online Test Banks
Score higher
See Online Test Banks
eLearning
Learning anything is easy
Browse Online Courses
Mobile Apps
Learning on the go
Explore Mobile Apps
Dummies Store
Shop for books and more
Start Shopping

HTML5 Document Organization Revisited

The framework for a simple HTML document consists of a head and body. The head provides information about the document to the browser (and sometimes also to the web server), and the body contains content that appears in the browser window. The first step in creating any HTML document is to define its framework.

An HTML document consists of a collection of markup elements — some required, many optional — where you can always find at least three elements:

  • The <html></html> opening and closing tags follow the DOCTYPE declaration and contain everything else inside the HTML document.

  • The <head></head> opening and closing tags follow the opening <html> tag. They contain definitions, labels, and information about the HTML document body that follows.

    Only certain markup elements are legal inside an HTML document head (which is another way of saying “may appear between the <head> and </head> tags”). The legal elements include base, link, meta, script, style, and title. (Collectively, these are known as HTMLHeadElements in the language of the HTML5 specification.)

  • The <body></body> opening and closing tags follow the closing </head> tag. They include the content and related markup for the HTML document. This is where 99 percent of the stuff that actually appears inside a web browser lives.

Any HTML markup element can appear in an HTML document body unless that element is the DOCTYPE, a major organizational container (namely, <html>, <head>, or <body>), or an element allowed only in a document head.

You could create an HTML document with no content in the <body>, but why would you want to? It would display only a title and no other information.

Likewise, you could build a complex body with only minimal markup in the <head> section (the <title> element is required, all other head-only elements are optional), but users and search engines that find your page might miss out on important info.

That’s why a properly structured HTML document includes a well-constructed <head> along with an equally well-crafted <body>. For HTML documents, a body needs a head, and a head needs a body.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.