What is HTML?
HTML (HyperText Markup Language) is the structure of every web page. It's not a programming language — it's a way of labeling content so the browser knows what each piece is: “this is a heading,” “this is a paragraph,” “this is an image.”
A finished web page is really three layers working together. HTML is always the foundation:
The anatomy of a tag
HTML is made of elements. Most elements have an opening tag, some content, and a closing tag. The closing tag is just the opening tag with a slash.
Some elements carry extra information called attributes, written inside the opening tag as name="value":
<img>, <br>, and <hr>. They do their whole job in one tag.Every page starts with the same skeleton
This boilerplate is the starting point for every HTML file. Type it once and you'll soon know it by heart.
<!DOCTYPE html> <!-- tells the browser: this is HTML5 --> <html lang="en"> <head> <!-- info ABOUT the page (not shown on screen) --> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- makes it work on phones --> <title>My First Page</title> <!-- shows on the browser tab --> </head> <body> <!-- everything you SEE goes here --> <h1>Hello, world!</h1> <p>My very first web page.</p> </body> </html>
<html>: the <head> holds behind-the-scenes info (title, character set, links to CSS), and the <body> holds everything the visitor actually sees.The tags you'll use every day
A handful of elements cover most pages. Here's each one — code on the left, the real result on the right.
Headings — <h1> to <h6>, biggest to smallest. Use one <h1> per page.
<h1>Title</h1> <h2>Subtitle</h2>
Title
Subtitle
Paragraph — <p> for blocks of text.
<p>HTML labels content so the browser knows what it is.</p>
HTML labels content so the browser knows what it is.
Link — <a> with an href. Image — <img> with src and alt.
<a href="https://example.com">Visit</a> <img src="cat.jpg" alt="A cat">
Lists — <ul> (bulleted) or <ol> (numbered), each item in an <li>.
<ul> <li>Bread</li> <li>Milk</li> </ul>
- Bread
- Milk
Nesting: elements live inside elements
You put elements inside other elements to build structure. An element inside another is its child; the one around it is the parent. Indent your code so the family tree is easy to see.
<body> ← parent
<section> ← child of body, parent of the h2 + p
<h2>About</h2>
<p>Hello there.</p>
</section>
</body>
<b><i>hi</i></b> ✓, never <b><i>hi</b></i> ✗.Attributes add information
Attributes live in the opening tag and configure the element. A few you'll meet constantly:
href="page.html" where a link goes src="photo.jpg" an image's file alt="Description" text if image fails id="main" a unique name class="card" a reusable label
id and class are how CSS and JavaScript find an element to style or control.
alt text is read aloud by screen readers — it's essential for accessibility.
Block vs. inline elements
Two ways elements take up space. Block elements stack vertically and fill the width. Inline elements sit in the flow of text, side by side.
Block — stacks & fills width
Each starts on a new line.
Inline — flows in a line
They sit within the sentence.
Putting it all together: your first page
Here's a complete, real page using everything above — skeleton, headings, a paragraph, a list, and a link, all nested correctly.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>About Me</title> </head> <body> <h1>Jordan Parker</h1> <p>I'm learning web design!</p> <h2>I like</h2> <ul> <li>HTML</li> <li>CSS</li> </ul> <a href="contact.html">Contact me</a> </body> </html>
Common beginner mistakes
Almost every “why is my page broken?” moment is one of these:
<p>Forgot to close
<img src="cat.jpg"> no alt text
<b><i>wrong</b></i> crossed tags
<H1>Loud Caps</H1> (works, but
lowercase is tidy)<p>Closed properly</p> <img src="cat.jpg" alt="A cat"> <b><i>right</i></b> <h1>Calm lowercase</h1>
alt text, and use lowercase tag names.Now you try — live editor
Edit the HTML on the left and watch the page update on the right instantly. Change the text, add an <h2>, add a list item — you can't break anything.
<h1> text, or add <p>Another line</p> before </body>.