⭐ HTML Document Structure
Every HTML webpage follows a standard structure. This structure helps the browser understand how to read, interpret, and display the content on the screen.
Think of it like the blueprint of a webpage.
Below is the basic structure of an HTML document:
⭐ Basic HTML Structure
Let’s break it down step by step.
⭐ 1. <!DOCTYPE html>
-
This is the document type declaration.
-
It tells the browser that this file is an HTML5 document.
-
It must always be the first line of every HTML file.
⭐ 2. <html>...</html>
-
This is the root element of the webpage.
-
Everything inside the webpage is written between these tags.
-
It contains two main sections:
-
<head> -
<body>
-
⭐ 3. <head>...</head>
The <head> section contains information about the webpage, not the content that appears on the screen.
This is called metadata.
Common things inside the head:
-
<title>— title of the page shown in the browser tab -
<meta>— SEO information, keywords, description -
<link>— linking CSS files -
<script>— linking JavaScript files -
<style>— internal CSS
Example:
⭐ 4. <body>...</body>
Everything you see on the webpage is inside the <body> section.
Examples:
-
Headings
-
Paragraphs
-
Images
-
Buttons
-
Forms
-
Tables
Example:
