Web Technologies - Old Questions

5.  Discuss the structure of HTML document with suitable example.

5 marks | Asked in 2071

HTML (Hyper Text Markup Language) is the standard markup language for creating Web pages. It describes the structure of a Web page.

Structure of HTML document

Every HTML document consists of four basic structure elements: html, head, title, and body. Each of these is explored in detail below:

1. Html Element

  • Start tag: <html> - First tag in the document which declares you are writing an HTML element.
  • End tag: </html> - Last tag in the document.

2. Head Element

  • Start tag: <head> - Second tag, follows the <html> tag, and starts the head section, which describes the document.
  • End tag: </head> - Fifth tag, follows the </title> tag and closes the head section.

3. Title Element

  • Start tag: <title> - Third tag, follows the <head> tag, and contains the title you want for the document. This information will be displayed in the title bar at the top of the browser window.
  • End tag: </title> - Fourth tag, immediately follows, without any spaces, the title you want for the document and precedes the </head> tag.

4. Body Element

  • Start tag: <body> - Sixth tag, follows the </head> tag to denote starting the content of the document.
  • End tag: </body> - Next to last tag in the document, follows the end of the document content and precedes the </html> tag. 

E.g. 

<!DOCTYPE html>

<html>

<head>

    <title>Page Title</title>

</head>

<body>

    <h1>My First Heading</h1>

    <p>My first paragraph.</p>

</body>

</html>