HTML Basics
You understand what HTML is and you have an editor set up. Now it's time to actually write some. This lesson covers the tags you'll use on literally every webpage you ever build — headings, paragraphs, line breaks, dividers, and images.
- The 4 Tags You'll Always Use
- HTML Headings
- Horizontal Line
- Paragraphs & Breaks
- HTML Images
- Common Mistakes
- Summary
- FAQ
The 4 Tags You'll Use on Every Page
Inside the <body> of your HTML file, these are the tags you reach for first. Not because they're the only ones — HTML has dozens — but because a page without a heading, some paragraphs, and maybe an image isn't much of a page at all.
HTML Headings
HTML gives you 6 heading levels. <h1> is the biggest and most important — use it for the main title of the page. Then use <h2> through <h6> for sections and subsections, in order, the way you'd outline a document.
One h1 per page — this matters for SEO. Google looks at your <h1> to understand what the page is about. Having multiple h1 tags confuses it. One h1 at the top, then h2 for each section below it — that's the correct pattern.
Heading 1 — Main page title
Heading 2 — Section title
Heading 3 — Subsection
Heading 4 — Sub-subsection
Heading 5 — Minor heading
Heading 6 — Smallest, least used
Notice how the browser automatically makes h1 the largest and reduces size as the number goes up. You don't need CSS to do this — it's the default browser styling.
<body> <h1>TipsInLearning — HTML Course</h1> <h2>Chapter 1: The Basics</h2> <h3>What are Headings?</h3> <h4>How browsers display them</h4> <h5>A note on accessibility</h5> <h6>The smallest heading level</h6> </body>
HTML Horizontal Line (<hr>)
The <hr> tag draws a horizontal line across the page. It's a self-closing tag — just write <hr> with no closing tag. Use it when you want a visible break between two sections of content.
<h1>Section One</h1> <p>This is the first section.</p> <hr> <!-- just this — no closing tag needed --> <h2>Section Two</h2> <p>This is the second section.</p>
Section One
This is the first section.
Section Two
This is the second section.
Paragraphs & Line Breaks
The <p> tag wraps a block of text as a paragraph. The browser adds spacing above and below automatically — you get that separation between paragraphs for free without any CSS.
The <br> tag is different. It breaks the current line and continues on the next one, but stays inside the same paragraph. Like pressing Enter once instead of starting a new paragraph.
<p> HTML stands for HyperText Markup Language.<br> CSS controls how pages look.<br> JavaScript makes them interactive. </p> <p>This second paragraph gets its own spacing block automatically.</p>
HTML stands for HyperText Markup Language.
CSS controls how pages look.
JavaScript makes them interactive.
This second paragraph gets its own spacing block automatically.
HTML Images
The <img> tag embeds an image. Like <hr> and <br>, it's self-closing — no closing tag. It needs two attributes to work properly: src tells the browser where the image is, and alt provides a text description.
Don't skip the alt attribute. When an image fails to load, the alt text shows in its place. Screen readers read it aloud to visually impaired users. Google uses it to understand what's in your image. An <img> without alt is like a caption-less photo — the browser accepts it but you're missing important functionality.
<!-- Image file in same folder as your HTML --> <img src="photo.jpg" alt="A photo of my project"> <!-- Image from the web, with set dimensions --> <img src="https://tipsinlearning.blogspot.com/logo.png" alt="TipsInLearning logo" width="300" height="150">
| Attribute | What it does | Example |
|---|---|---|
| src | Path or URL of the image file. Without this, nothing shows. | src="photo.jpg" |
| alt | Text description shown when image can't load — also read by screen readers and indexed by Google. | alt="My photo" |
| width | Display width in pixels. If you set width only, height scales automatically. | width="300" |
| height | Display height in pixels. Set both width and height to avoid layout shift while page loads. | height="200" |
Mistakes to Avoid in This Lesson
Beginners sometimes use <h1> for everything that looks big. But <h1> has an SEO purpose — it tells Google what the page is about. Use it once, at the top. For everything else, use <h2>, <h3>, and so on in logical order.
These are self-closing tags — they don't need a partner. Writing <br></br> or <img src="..."></img> won't break anything in most browsers, but it's wrong HTML and it tells Google your page has errors. Just write the single tag and move on.
A common beginner habit: writing all text in one block and hitting <br><br> between paragraphs to create spacing. This works visually but it's semantically wrong — search engines and screen readers see it as one big block of text, not separate paragraphs. Use <p> for actual paragraphs.
Questions About HTML Basics
Things beginners get confused about when first using these tags: