Structure of HTML
Structure of an HTML Document
Every HTML page follows a fixed basic structure that tells the browser how to read and display the webpage.
Basic HTML Document Structure
Explanation of Each Part
1. <!DOCTYPE html>
-
Declares the document type
-
Tells the browser this is an HTML5 document
-
Must be the first line in the file
📌 Without it, browsers may behave unpredictably.
2. <html> Tag
-
Root (parent) element of the HTML page
-
All other tags are written inside it
3. <head> Section
Contains information about the webpage, not visible to users.
Common elements inside <head>:
-
<title>– page title -
<meta>– character set, viewport, SEO -
<link>– CSS files -
<style>– internal CSS -
<script>– JavaScript (sometimes)
Example:
4. <title> Tag
-
Sets the browser tab title
-
Used by search engines
-
Must be inside
<head>
5. <body> Section
Contains all visible content of the webpage.
Examples:
-
Headings
-
Paragraphs
-
Images
-
Links
-
Forms
-
Tables
Diagram Representation
Complete Example
Important Points (Exam / Interview)
✔ <!DOCTYPE html> defines HTML version
✔ <html> is the root element
✔ <head> contains metadata
✔ <body> contains visible content
✔ <title> appears on browser tab
Comments
Post a Comment