Skip to content
Azril Hakim
LinkedInGitHub

Basic Structure

HTML (Hypertext Markup Language) is the backbone of web pages. Understanding the basic structure of an HTML document is essential when learning web development. An HTML document is composed of various elements and tags that define the structure and content of a webpage.

HTML Document Skeleton

An HTML document typically follows this basic structure:

<!DOCTYPE html>
<html>
<head>
    <title>Document Title</title>
</head>
<body>
    <!-- Content Goes Here -->
</body>
</html>

Let’s break down each part:

  • <!DOCTYPE html>: This declaration tells the browser that the document is written in HTML5, the latest version of HTML.

  • <html>: The root element that encloses the entire HTML document.

  • <head>: This section contains meta-information about the document, such as the document title, character encoding, and links to external resources like stylesheets or JavaScript files.

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

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

Adding Comments

In HTML, you can add comments to your code to provide explanations or notes to yourself or other developers. Comments are not displayed on the webpage and are only visible in the HTML source code.

To add a comment, use the <!-- --> syntax:

<!-- This is a comment. -->

Comments can be helpful for documenting your code and making it more understandable.

Now that you understand the basic structure of an HTML document, let’s explore HTML elements and tags to create content within your webpage.