Title: HTML File Structure
Course: CPS 120: Introduction to Computer Science ~ Master (Aug/2015) OLD > Section: Learning Units

A web page file under version HTML5 has the following structure:

<!DOCTYPE html>
<html>

<head>
<title>Title of the document</title>
</head>

<body>
Content of the document
</body>

</html>

<!DOCTYPE html>

- Must be the first line in an HTML5 web page file.
- Informs the web browser which version of HTML the page is written in.

<html>

- Informs the web browser that the web page file is an HTML document.
- Is the container for all other HTML statements.

<head>

Is the container for the following HTML statements:

- <title> – name of the web page.
- <style> – styles used in the web page.
- <base> – base web address for all web addresses in the web page.
- <link> – connections to external files, usually style files.
- <meta> – information about the web page including author, description, and keywords.
- <script> – scripts used in the web page.

<body>

Is the container for the content of the web page.

HTML tags

- A browser does not show the HTML statements in a displayed web page, but uses them to construct the displayed web page.
- Within a web page file, the browser needs to be able to distinguish between HTML and content. This is accomplished with tags.
- All HTML statements are enclosed in angle brackets.
- Some HTML statements have opening and closing tags, while others are unpaired.
- Often, one pair of tags is enclosed by another pair of tags.
- Some of the more common HTML statements/tags are listed in the HTML Toolbox available on Blackboard.

Viewing HTML source

- In Google Chrome, Microsoft Internet Explorer, and Mozilla Firefox, pressing CTRL-U from a web page shows the HTML and content that underlies the page.