HTML Basics: Tags, Headings, Paragraphs and Lists
HTML is made of tags. Most tags work the same way, so learning a few teaches you the pattern.
Tags inside tags (nesting)
Tags can go inside other tags. This is called nesting. The rule is simple: the last tag you opened is the first one you close, like boxes inside boxes.
<!-- Correct: strong is closed before p -->
<p>This is <strong>very</strong> important.</p>
<!-- Wrong: the tags cross each other -->
<p>This is <strong>very important.</p></strong>Indent the inner tags with two spaces. It shows you at a glance which tag is inside which:
<ul>
<li>Fruits
<ul>
<li>Mango</li>
<li>Banana</li>
</ul>
</li>
</ul>- Fruits
- Mango
- Banana
The basic page structure
Every HTML page uses the same starting structure. Copy it every time you make a new page.
<html> holds a <head> and a <body>.<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Page title for Google and the browser tab</title>
</head>
<body>
<!-- Everything people see goes here -->
</body>
</html><!DOCTYPE html>tells the browser "this is a modern HTML page".<html lang="en">wraps the whole page.langtells Google and screen readers the language.<head>holds information about the page. People do not see it on the page.<body>holds everything people see.
Headings and paragraphs
There are six heading levels, <h1> to <h6>. h1 is the most important. Use only one h1 per page. It is the main title. Google reads headings to understand your page.
<h1>My Travel Blog</h1>
<h2>Trip to Jaipur</h2>
<p>Jaipur is called the Pink City.</p>
<h3>Where we stayed</h3>
<p>We stayed near Hawa Mahal.</p>Jaipur is called the Pink City.
We stayed near Hawa Mahal.
Bold, italic and line breaks
<p>This is <strong>very important</strong> text.</p>
<p>This word has <em>emphasis</em>.</p>
<p>Line one<br>Line two</p>
<hr>This is very important text.
This word has emphasis.
Line one
Line two
<br> and <hr> have no closing tag. They are called empty elements.
Spaces and new lines are ignored
This surprises everyone at first. The browser turns many spaces and new lines into one single space.
<p>Hello
world</p>Hello world
To control where text breaks, use tags: a new <p> for a new paragraph, or <br> for a line break inside one (useful for addresses and poems). Spacing between blocks is a job for CSS, which you will learn soon.
Special characters
Some characters have a special meaning in HTML. If you want to show them as normal text, write a short code instead. These codes are called entities.
| You want to show | Write this |
|---|---|
| < | < |
| > | > |
| & | & |
| © | © |
| A space that never breaks | |
<p>Use the <p> tag for paragraphs. © 2026 My Site</p>Use the <p> tag for paragraphs. © 2026 My Site
Lists
Use <ul> for a list with bullet points (order does not matter). Use <ol> for a numbered list (order matters). Each item goes inside <li>.
<h3>Shopping list</h3>
<ul>
<li>Milk</li>
<li>Bread</li>
</ul>
<h3>Make tea</h3>
<ol>
<li>Boil water</li>
<li>Add tea leaves</li>
<li>Add milk and sugar</li>
</ol>- Milk
- Bread
- Boil water
- Add tea leaves
- Add milk and sugar
One more list: the description list
For a word and its meaning, like a glossary or FAQ, use <dl>. Each term goes in <dt> and its description in <dd>.
<dl>
<dt>HTML</dt>
<dd>The language for page structure.</dd>
<dt>CSS</dt>
<dd>The language for page design.</dd>
</dl>- HTML
- The language for page structure.
- CSS
- The language for page design.
Check your HTML for mistakes
Browsers are kind. They try to show a page even when the HTML is broken, so mistakes can hide. A validator finds them for you.
- Open the free W3C validator at validator.w3.org.
- Choose Validate by Direct Input and paste your code.
- Click Check. Fix the first error first, because one mistake often causes several messages.
Mini project: an "About me" page
Let us use everything from this chapter in one page. Make a new file called about.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>About Priya</title>
</head>
<body>
<h1>Hi, I'm Priya</h1>
<p>I am learning <strong>web development</strong> and I love cooking.</p>
<h2>My skills</h2>
<ul>
<li>HTML (learning now)</li>
<li>CSS (next month)</li>
</ul>
<h2>My goals for this year</h2>
<ol>
<li>Finish this course</li>
<li>Build a recipe website</li>
<li>Get my first freelance client</li>
</ol>
</body>
</html>Change the name, skills and goals to your own. It looks plain for now. In chapter 4 you will make it look good with CSS.
Common mistakes
| Mistake | Fix |
|---|---|
| Forgetting a closing tag, so everything after it turns bold or big | Check that each opening tag has its closing tag |
Using <br> many times to make space | Use separate paragraphs, then add space with CSS |
Putting text directly in <ul> | Every item must be inside <li> |
| Skipping from h1 to h4 because h4 "looks right" | Go in order (h1, h2, h3) and change the size with CSS |
Practice time
- Make a page called
about.htmlwith one h1, two h2 sections and a paragraph under each. - Add a numbered list of your three favourite foods.
- Make one word bold and one word italic.
- Paste your about page into the W3C validator and fix any errors.
- Show the text
<h1>on a page so it appears as text, not as a heading.
Quick summary
- Tags come in pairs:
<p>and</p>. - Use the same page structure every time: doctype, html, head, body.
- One h1 per page. Pick heading levels by importance.
ul= bullets,ol= numbers,li= each item.
Comments
A comment is a note for you or other developers. The browser does not show it.