Home

Anatomy of the in HTML5

|
Updated:  
2016-03-26 14:02:58
|
HTML5 and CSS3 All-in-One For Dummies
Explore Book
Buy On Amazon

HTML document structure is hierarchical, so an entire document includes a head section. Thus, immediately following the opening element is where you define the head section, starting with an opening element and ending with a closing element.

Meeting the himself

The head is one of two main components in any HTML document; the body is the other main component. The head, or header, provides basic information about the document, including its title and metadata (information about information), such as keywords, character encoding, author information, and a description.

If you want to use an external style sheet within a page, information about that style sheet also goes into the header. Please do likewise — that is, add information to the head — if you want to establish a base for URLs referenced in a document, or call a script.

The element, which defines the page header, immediately follows the opening element:

<!DOCTYPE html>
<html>
  <head>
  </head>
</html>

Handling metadata with

Literally, metadata means data or information about data. Thus, the meta element is used to provide information about the HTML document inside which it appears. All elements always appear inside the HTML , and may be used to define the character encoding — that is, the bit level codes used to represent character data — inside an HTML document.

They can also define keywords for search engines, describe document content, identify the document’s author, define a document refresh interval (the interval at which a page automatically reloads itself), and more.

This listing shows all of these things for a hypothetical HTML document.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8"> <!-- defines default HTML character codes →
    <meta name="keywords" content="HTML, CSS, meta tag examples">
    <meta name="author" content="Ed Tittel"> <!-- identifies author →
    <meta name="description" content="meta element discussion →
    <meta http-equiv="refresh" content="1800"> <!-- refresh every 30 mins →
    <title>Lots of head markup, no body</title>
  </head>
  <body></body>
</html>

A element that identifies a charset is required for a web page to validate at validator.w3.org. (as is a element). Don’t leave them out! For more information about the HTML element, for which there are umpty-ump cases and examples, please consult one or more of the following:

If you take the time to enter the HTML markup from the listing, you see a web page with the title “Lots of head markup, no body” but nothing else to show for itself. If you can’t see the full title in the browser tab, hover the mouse cursor over the title, and the whole thing appears in a small text box.

If you’d rather skip the text entry work, check out the screenshot in this figure.

image0.jpg

About This Article

This article is from the book: 

About the book author:

Ed Tittel is a 28-year veteran of the computer industry. A seasoned author and consultant, Ed has more than 140 books to his credit.

Chris Minnick is an accomplished author, teacher, and programmer. Minnick authored or co-authored over 20 books, including titles in the For Dummies series. He has developed video courses for top online training platforms and he teaches programming and machine learning to professional developers at some of the largest global companies.