0% completed
In this lesson, we'll explore the essential framework that every HTML document relies on. Understanding this structure is crucial as it ensures that your web pages are correctly interpreted by browsers and provides a solid foundation for adding content.
Every HTML document follows a standard structure that organizes the content and tells the browser how to display it. Let's break down the fundamental parts:
It declares the document type and version of HTML being used.
Usage: Always the very first line in your HTML document.
<!DOCTYPE html>
It serves as the root element that wraps all other HTML elements.
Usage: Encloses the entire content of the web page.
<html> <!-- All other elements go inside here --> </html>
It contains meta-information about the document, such as the title.
Usage: Placed inside the <html>
tag, before the <body>
.
<head> <title>Your Page Title</title> </head>
It specifies the title of the HTML document.
Usage: Appears within the <head>
section and shows up on the browser tab.
<title>My First Web Page</title>
It contains all the content that will be displayed on the web page, such as text, images, and links.
Usage: Placed inside the <html>
tag, after the <head>
.
<body> <!-- Your visible content goes here --> </body>
Let's combine all these elements to create a complete HTML document. You can execute the below HTML code and observe the output.
<!DOCTYPE html>
: Tells the browser that this is an HTML5 document.<html>
: The root element that wraps the entire content.<head>
: Contains the <title>
, which sets the name of the browser tab.<body>
: Holds the content that users see, such as headings and paragraphs......
.....
.....