Prev

Basic Tags

Page Structure: <html>, <head> & <body>

HTML Page Structure
<html>

<head>
</head>


<body>
</body>


</html>

Try It: Add Code
In your brand new file, add the code above. Look at your file in a browser. It should be blank.
An HTML file has two parts, the head and the body. The head or header has information about the HTML file and the body contains the actual content you want to display in the browser.

Every HTML page should begin with the <html> tag. It tells the browser that the HTML is starting. Likewise, the matching end tag, </html> tells the browser the HTML is ending. Some browsers will not display any text that appears before the <html> tag or after the </html> tag.

There are also tags for each of the two parts, the <head> tag and the <body> tag. The <head> and <body> tags always go inside the <html> tag. Notice how the <head> tag ends before the <body> tag begins. As you can see in the diagram, all three of these tags are container tags: they have a start tag and an end tag.

The <title> Tag

Try It: Add Title
Try adding the <title> tag to your file. Reload your page to see your title appear.
...
<head>
<title>My Title</title>
</head>
...
The <title> tag is an example of a tag that goes in the <head> and only there, never in the <body>. This is because it describes something about the page (the title) rather than appearing in the page itself.

Like the other tags you've learned so far, <title> is a container tag. The text you put between the start tag and the end tag is what the browser uses as the title of the window displaying the page.

Prev