HTML – Document Structure

HTML – Document Structure

The HTML (Hypertext Markup Language) document structure is the way the content of a web page is organized and structured. The basic structure of an HTML document consists of the following elements:

  1. DOCTYPE Declaration: This declares the version of HTML being used, which is typically <!DOCTYPE html> for HTML5.
  2. <html> Element: This is the root element of the HTML document and contains the entire web page content.
  3. <head> Element: This section contains metadata about the web page, such as the title, character encoding, and links to external stylesheets or scripts.
  4. <title> Element: This element sets the title of the web page, which is displayed in the browser’s title bar or tab.
  5. <body> Element: This is where the visible content of the web page is placed, such as headings, paragraphs, images, and other HTML elements.

The basic structure of an HTML document looks like this:

<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
</head>
<body>
<h1>Welcome to my web page</h1>
<p>This is a paragraph of text.</p>
<!-- Additional content goes here -->
</body>
</html>

Here’s a breakdown of the elements:

  • <!DOCTYPE html>: Declares the document type as HTML5.
  • <html>: The root element that contains the entire web page content.
  • <head>: Contains metadata about the web page, such as the title.
  • <title>: Sets the title of the web page, which is displayed in the browser’s title bar or tab.
  • <body>: Contains the visible content of the web page, such as headings, paragraphs, and other HTML elements.

The structure of an HTML document provides a clear and organized way to present the content of a web page. It helps browsers understand the hierarchy and relationship of the different elements on the page, which is crucial for proper rendering and accessibility.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *