Basic structure of an HTML document

The basic structure of an HTML document consists of 5 elements:

  1. <!DOCTYPE>
  2. <html>
  3. <head>
  4. <title>
  5. <body>

A DOCTYPE declaration must be specified on the first line of each web document:doctypeThe DOCTYPE tells the web browser which version of HTML the page is written in.  In this class, we will be using ‘XHTML Transitional’, which allows us a little flexibility.

The <html> Element
Immediately following the DOCTYPE declaration is the <html> element:html-element
The <html> element tells the browser that the page will be formatted in HTML and, optionally, which world language the page content is in.

The <head> and <body> Elementshead-body
The <head> element surrounds all the special “behind the scenes” elements of a web document.  Most of these elements do not get displayed directly on the web page.
The <body> element surrounds all the actual content (text, images, videos, links, etc.) that will be displayed on our web page.

The <meta> Element
Immediately after the <head> line, we place this <meta> element:meta-elementThis line declares that the document is encoded in the UTF-8 (Unicode) character set.

There can be multiple <meta> lines in the same web page.  The <meta> element is often used to provide additional information such as page keywords, a page description, and the author(s) of a web document.

The <title> Element
The <title> element defines what text will show in the web browser’s title bar:title-element
Every web document must include one and only one instance of DOCTYPE, <html>, <head>, <body>, and <title>.