Text & Headings
Learn how to format text with headings, paragraphs, and emphasis. Continue →
Now that you understand what HTML is, let’s create your first complete webpage! You’ll learn the essential structure that every HTML document needs.
What you’ll learn:
<html>, <head>, and <body> elementsPrerequisites:
Every HTML document follows a standard structure. Think of it like a sandwich:
<html> element (everything)<head> element (information about the page)<body> element (the visible content)Here’s what a complete HTML document looks like:
Let’s break down each part:
<!DOCTYPE html>This tells the browser that this is an HTML5 document. It must be the very first line of every HTML file. Think of it as a label on the document.
<html> Element<html lang="en"> <!-- Everything else goes inside here --></html>The <html> element wraps your entire document. Notice the lang="en" attribute? That tells search engines and assistive devices that the page is in English.
<head> Element<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My First Webpage</title></head>The <head> element contains information about the page, not content users see. It includes:
<meta charset="UTF-8">
<meta name="viewport" ...>
<title>...</title>
<body> Element<body> <h1>Welcome to My Website!</h1> <p>This is my first HTML page.</p></body>Everything inside <body> is visible on the webpage. This is where you put headings, paragraphs, images, links—all the content users see.
Let’s make this real! Follow these steps:
Open a text editor — Use Notepad, VS Code, Sublime Text, or any text editor
Copy this code:
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My Awesome First Page</title> </head> <body> <h1>Hello, World!</h1> <p>I just created my first HTML page!</p> </body></html>Save the file — Name it index.html
.html (not .txt)Open in a browser — Double-click the file to open it
Edit this code to personalize your page:
Experiment with:
<title> text (look at the browser tab)Here’s a template you can use for all your future pages. Just copy and modify:
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Page Title Here</title> </head> <body> <!-- Your content goes here --> </body></html><!DOCTYPE html>, <html>, <head>, and <body><head> contains metadata like title and viewport settings<body> contains all visible content.html extension<title> appears in browser tabs and search resultsText & Headings
Learn how to format text with headings, paragraphs, and emphasis. Continue →
Element Reference
Look up any HTML element you need. Browse →