HTML Page Basics

Document Type Definition

This is used to indicate to the browser which version of HTML being used.

<!doctype html>

HTML Element

The HTML element indicates that the document is formatted as HTML. The language (lang) attribute is used to specify the language. The default is English, but specifying the language is a good idea.

Beginning Element: <html lang="en">

Ending Element: </html>

Head Element

The head element defines the head section of the web page; this is used to describe the document. Do not confuse this with the header, which will be discussed later.

Beginning Element: <head>

Ending Element: </head>

Title Element

The title element is contained within the head element. Title defines the document title, and will appear at the top of the browser window in the tab.

<title>This is my title.</title>

Meta Element

The meta element describes characteristics of the web page. For example, it can be used to specify the character encoding. Note that the meta element is a self-contained or void element; there is no ending element. Meta is also contained within the head element.

The meta element is also used to define the inital scale for the viewport.

<meta charset="utf-8">

<meta name="viewport" content="initial-scale=1.0">

Body Element

The body element defines the actual content of the page.

Beginning element: <body>

Ending element: </body>

Full Example

<!doctype html>
<html lang="en">

<head>
    <title>Sample Title</title>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0">  
</head>

<body>
</body>
</html>