HTML documents have a specific structure that defines how content is organized and presented.
Here is the basic structure of HTML document:

Let’s break down the components of the HTML document structure:
- Document Type Declaration (
<!DOCTYPE html>
):- Specifies the HTML version being used.
<!DOCTYPE html>
is the declaration for HTML5, the latest version.
- Specifies the HTML version being used.
- HTML Element (
<html>
):- The root element of the HTML document. It wraps all the content on the page.
- The
lang
attribute specifies the language of the document (e.g., “en” for English).
- Head Element (
<head>
):- Contains metadata about the document, such as character set, viewport settings, and the document title.
- Meta tags (
<meta>
) provide additional information about the document.
- Charset and Viewport Meta Tags:
<meta charset="UTF-8">
: Specifies the character encoding for the document (UTF-8 is widely used).<meta name="viewport" content="width=device-width, initial-scale=1.0">
: Ensures proper rendering on various devices.
- Title Element (
<title>
):- Defines the title of the HTML document, which appears in the browser’s title bar or tab.
- Body Element (
<body>
):- Contains the main content of the HTML document, such as text, images, links, and other elements.
- All visible content is placed inside the
<body>
tags.
- Main Content:
- Various HTML elements are used to structure and present content within the
<body>
tags. Examples include headings (<h1>
,<h2>
), paragraphs (<p>
), lists (<ul>
,<ol>
), images (<img>
), and more.
- Various HTML elements are used to structure and present content within the