HTML Structure Basics

SaimCan
2 min readSep 23, 2023

--

The basic structure of an HTML (Hypertext Markup Language) document consists of various elements that provide the framework for creating web pages. Here’s a look at a simple HTML template with the basic components:

<!DOCTYPE html> <!-- Document type declaration -->
<html lang="en"> <!-- The root element for an HTML document -->

<head> <!-- Contains meta-information about the document -->
<meta charset="UTF-8"> <!-- Character encoding for the document -->
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Responsive viewport -->
<title>Document Title</title> <!-- The title of the document, displayed in the browser tab -->
</head>

<body> <!-- Contains the visible content of the document -->
<header> <!-- Typically includes the page header or site logo -->
<h1>My Website</h1> <!-- Main heading for the page -->
<nav> <!-- Navigation menu -->
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>

<main> <!-- Main content area of the page -->
<h2>Welcome to My Website</h2>
<p>This is a simple HTML template.</p>
</main>

<footer> <!-- Footer section at the bottom of the page -->
<p>&copy; 2023 My Website</p> <!-- Copyright notice -->
</footer>
</body>

</html>

Here’s a breakdown of the key components:

  1. <!DOCTYPE html>: Declares the document type and version of HTML being used (HTML5 in this case).
  2. <html lang="en">: The root element of the document, indicating that it's an HTML document with the language set to English.
  3. <head>: Contains meta-information about the document, such as character encoding, viewport settings, and the page title.
  4. <meta charset="UTF-8">: Specifies the character encoding of the document (UTF-8 is a widely used encoding for text on the web).
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">: Sets the viewport settings for responsive design on various devices.
  6. <title>: Defines the title of the web page, which appears in the browser's title bar or tab.
  7. <body>: Contains the visible content of the web page, including headings, paragraphs, images, and other elements.
  8. <header>: Typically includes the page header, site logo, and navigation menu.
  9. <nav>: Contains the navigation menu, often as an unordered list (<ul>) with list items (<li>) and anchor links (<a>).
  10. <main>: Houses the main content of the page, such as articles, blog posts, or the primary information.
  11. <footer>: Contains information at the bottom of the page, such as copyright notices or contact information.

This is a basic structure and we can add more elements and styles to create a complete web page. HTML is highly extensible and allows us to combine CSS (Cascading Style Sheets) for design and JavaScript for interactivity when necessary.

Thank you for reading…

--

--

No responses yet