Basic Structure of an HTML Document

Reading through my previous article, I gave a glimpse of what HTML is and how to create one, this time around I will give you what the structure of an HTML document looks like.

Basic Structure of an HTML Document

An HTML document has a specific structure that serves as the foundation for every webpage. Below is an example of one;

<!DOCTYPE html>
<html>
<head>
    <title>Page Title</title>
</head>
<body>

<!-- Content goes here -->

</body>
</html>
  • <!DOCTYPE html>: This declaration defines the document type and version of HTML. In modern web development, HTML5 is the latest version.

  • <html>: The root element that wraps the entire HTML content.

  • <head>: Contains meta-information about the HTML document, such as the title, character set, and linked stylesheets.

  • <title>: Sets the title of the webpage, which appears in the browser's title bar or tab.

  • <body>: Encloses the main content of the webpage, including text, images, links, and other elements.

Meta Tags (<meta>):

Meta tags provide metadata(more description) about the HTML document. Some common <meta> tags include:

  • <meta charset="UTF-8">: Specifies the character encoding for the document.

  • <meta name="viewport" content="width=device-width, initial-scale=1.0">: Defines the viewport settings for responsive web design.

By now you should be familiar with how an HTML page is structured.