Introduction to HTML Tags
A beginner-friendly introduction to HTML tags: headings, paragraphs, links, images, lists and the page skeleton. Learn how tags work with runnable examples, a worked page and a quiz.
Key takeaways
- HTML uses tags to label parts of a page, like headings and paragraphs
- Most tags come in pairs: an opening <tag> and a closing </tag>
- Headings <h1> to <h6> give text structure; <p> marks paragraphs
- Links use <a href> and images use <img src> with attributes
- Every page sits inside a standard html, head and body skeleton
What HTML is for
Every web page you've ever visited is built from HTML — HyperText Markup Language. HTML doesn't make decisions or do maths. Its job is to label the parts of a page so the browser knows what each piece of content is: "this is a heading," "this is a paragraph," "this is a link." The browser reads those labels and draws the page.
The labels are called tags. Learning HTML is mostly about learning which tag fits which job. If you've already seen how the internet works, you know the browser downloads a file of HTML and turns it into the page you see.
How a tag works
Most tags come in pairs that wrap around content:
<p>This is a paragraph of text.</p>
Breaking that down:
<p>is the opening tag. It says "a paragraph starts here."This is a paragraph of text.is the content the tag wraps.</p>is the closing tag. The forward slash/means "the paragraph ends here."
The opening tag, content and closing tag together form an element. Forgetting the closing tag is one of the most common beginner slips, so always check your slashes.
Headings: from biggest to smallest
Headings give your page structure, like the title of a chapter and its sections. There are six levels, <h1> through <h6>:
<h1>My Pet Blog</h1>
<h2>About My Dog</h2>
<h3>Favourite Walks</h3>
<h1>is the largest and most important — use just one per page, for the main title.<h2>marks major sections,<h3>marks sub-sections, and so on down to<h6>.
Search engines and screen readers use this order to understand your page, so the levels are about meaning, not just size. Don't pick a heading just because it looks big.
Paragraphs and line breaks
Body text goes in paragraph elements:
<p>HTML is the skeleton of every web page.</p>
<p>CSS adds the colours and layout on top.</p>
Each <p> becomes its own block with space around it. If you only need a single line break inside a paragraph, use the empty <br> tag — it has no closing tag because it wraps nothing.
Attributes: extra information
Some tags need more details, given as attributes inside the opening tag. An attribute has a name, an equals sign, and a value in quotes. The clearest examples are links and images.
A link uses the <a> (anchor) tag with an href attribute holding the destination:
<a href="https://example.com">Visit Example</a>
href="https://example.com"is the web address to open.Visit Exampleis the clickable text the visitor sees.
An image uses the <img> tag. It is self-closing — there's no content to wrap, so no closing tag:
<img src="cat.jpg" alt="A ginger cat asleep on a sofa">
srcis the file or address of the picture.altis a text description, read aloud to people who can't see the image and shown if the picture fails to load. Always include it.
Lists
HTML offers two everyday list types. An unordered list uses bullets:
<ul>
<li>Apples</li>
<li>Bread</li>
<li>Cheese</li>
</ul>
An ordered list uses numbers:
<ol>
<li>Preheat the oven</li>
<li>Mix the batter</li>
<li>Bake for 20 minutes</li>
</ol>
Each item sits in its own <li> (list item) tag, and all the items live inside a <ul> or <ol> wrapper. The browser adds the bullets or numbers automatically.
The page skeleton
A complete HTML file needs a standard wrapper so the browser knows what it's reading. Here is the minimum structure:
<!DOCTYPE html>
<html>
<head>
<title>My First Page</title>
</head>
<body>
<h1>Hello, web!</h1>
<p>This is my very first web page.</p>
</body>
</html>
Line by line:
<!DOCTYPE html>tells the browser this is modern HTML. Put it at the very top.<html>wraps the entire document.<head>holds behind-the-scenes information the visitor doesn't see directly. Inside it,<title>sets the text shown on the browser tab.<body>holds everything visible: your headings, paragraphs, links and images.
Notice how the tags nest neatly inside one another, like boxes within boxes. Keeping them tidy with indentation makes mistakes easier to spot.
Worked example: a tiny profile page
Let's combine the tags into one real page:
<!DOCTYPE html>
<html>
<head>
<title>About Maya</title>
</head>
<body>
<h1>Maya's Corner</h1>
<p>Hi! I'm learning to build web pages.</p>
<h2>Things I like</h2>
<ul>
<li>Drawing</li>
<li>Coding</li>
<li>Football</li>
</ul>
<p>Here is a useful link:
<a href="https://example.com">my favourite site</a>.
</p>
</body>
</html>
Save this as about.html, then double-click the file to open it in a browser. You'll see a heading, an intro paragraph, a bulleted list and a clickable link — all from plain tags.
Try it yourself
Build your own one-page profile:
- Give the page a
<title>so the browser tab reads nicely. - Add an
<h1>with your name and a short<p>introducing yourself. - Make an
<ol>of three goals you have for this year. - Add a link to a website you like.
- (Bonus) Add an
<img>of something you enjoy, and write a clearaltdescription.
When your tags are working, the next step is making it look good. Head to build a simple web page to assemble a fuller page, then style web pages with CSS to add colour and layout.
Quick quiz
Test yourself and earn XP
What does a closing tag look like?
A closing tag has a forward slash before the name, like </p>. It marks where the element ends.
Which tag makes the biggest, most important heading?
<h1> is the top-level heading. The numbers go from h1 (largest, most important) down to h6 (smallest).
What goes inside the href attribute of a link?
href holds the destination URL. The clickable text goes between the opening and closing <a> tags.
Which tag does NOT need a closing tag?
<img> is a self-closing (empty) element. It carries all its information in attributes, so there is nothing to wrap.
Where does the visible content of a page go?
The <body> holds everything the visitor sees. The <head> holds behind-the-scenes info like the page title.
FAQ
Not exactly. HTML is a markup language: it describes and structures content rather than performing logic or calculations. You add interactivity with JavaScript and styling with CSS. Together they build modern web pages.
No. Any plain text editor works, and every web browser can open an HTML file. Save your file with a .html ending, then double-click it to see it render. Free editors like VS Code add helpful colour and autocomplete.
Keep exploring
More in Coding