You now know the building blocks. This lesson sharpens your craft: the mistakes that trip up almost every beginner, and the habits that separate messy HTML from clean, professional, valid markup.
The most common mistakes
Most HTML problems come from a short list of repeat offenders. Recognising them is half the battle.
- Forgetting to close tags (a <p> with no </p>)
- Wrong nesting — closing tags in the wrong order
- Missing alt attributes on images
- Inline styles everywhere instead of CSS
- Using <div> for everything instead of semantic elements
- Multiple <h1> elements or skipped heading levels
- Inputs without labels
- Reusing the same id on more than one element
Closing and nesting correctly
Tags must be closed and nested like boxes inside boxes — the last one opened is the first one closed. Crossing them over leads to unpredictable rendering.
- <p><strong>Hi</p></strong>
- Tags cross over
- Browser guesses
- Unpredictable result
- <p><strong>Hi</strong></p>
- Inner closes first
- Clean structure
- Reliable result
Best practices
A handful of habits keep your HTML clean and professional. None are hard — they just need to become automatic.
- Close every tag and nest them correctly
- Use semantic elements before reaching for <div>
- Write descriptive alt text on every meaningful image
- Connect every form input to a label
- Keep styling in CSS, not inline
- Use one h1 and a logical heading order
- Indent your code so structure is easy to read
Validate your HTML
You do not have to catch every mistake by eye. The free W3C Markup Validator checks your HTML and reports errors like unclosed tags or bad nesting. Running your page through it is a professional habit and a great way to learn — fix what it flags and your HTML improves fast.
Take any page you built earlier in this course and run it through the checklist above. Fix every issue you find. If you can, paste it into the W3C Markup Validator and clear every error.
1. Which is correctly nested?
2. Why validate your HTML?
3. Which is a best practice?
4. How many times can an id be used on a page?
- Common mistakes: unclosed tags, bad nesting, missing alt, inline styles, div soup.
- Close and nest tags correctly — inner closes before outer.
- Follow best practices: semantic elements, alt text, labels, CSS, one h1.
- Validate with the W3C Markup Validator to catch hidden errors.