(click anywhere to close)
OPEN MENU

[HTML5] Page Structure: Head & Body

category: Website | course: HTML5 | difficulty:

Every HTML document needs a specific basic structure. This is nothing too fancy, just a few tags that determine where everything needs to be. The bare minimum for creating a web page is this small framework:

<!DOCTYPE html>
<html>
	<head>
		<!-- Head Content -->
	</head>

	<body>
		<!-- Body Content -->
	</body>
</html>

At the top is something unique, the doctype declaration. This tells the browser what version of HTML to use, but has become somewhat redundant now that nearly everything is interpreted the right way using HTML5. Nevertheless, it’s wise to always include it to ensure maximum compatibility among (older versions of) browsers.

After the doctype comes an html tag, and your whole webpage lives inside that element. The only necessary elements are the head and the body (in that order).

The Head Tag

The head tag describes your web page – anything you put in it is not visible on the page. You can use it to add metadata such as a description, keywords and title.

Its primary use, however, is loading external files to use on the page, such as scripts and stylesheets.

More about what you can put inside the head tag can be found in the chapter Head.

The Body Tag

The body tag is the web page. Everything that is inside it is laid out underneath each other on the page, from top to bottom.

Unlike the head tag, there are a lot of elements you can put in there, and those will be discussed in the rest of this course.

CONTINUE WITH THIS COURSE
Test your knowledge with the quiz!
What has the property/properties contains all the (visible) content of the page?
A
The <body> tag
B
The <html> tag
C
The <head> tag
Do you like my tutorials?
To keep this site running, donate some motivational food!
Crisps
(€2.00)
Chocolate Milk
(€3.50)
Pizza
(€5.00)