🧱 HTML Basics

12 Common HTML Mistakes Beginners Make (And How to Fix Them)

By The CodeCraft Team··7 min read
Red highlight over HTML code showing common errors

Everyone writes bad HTML when they're learning — that's normal. What matters is recognising the patterns so you can stop repeating them. Here are the twelve mistakes I see most often in code reviews.

  1. Missing the <!doctype html> declaration
  2. Nesting block elements inside <a> incorrectly
  3. Using <br> for spacing instead of CSS margins
  4. Skipping the alt attribute on images
  5. Using multiple <h1> tags for visual size
  6. Forgetting <label> on form inputs
  7. Wrapping everything in <div>
  8. Using <i> and <b> instead of <em> and <strong>
  9. Inline style attributes everywhere
  10. Not closing self-closing tags consistently
  11. Tables for layout (it's 2026!)
  12. Missing viewport meta tag

The viewport meta everyone forgets

<meta name="viewport" content="width=device-width, initial-scale=1" />

Without it, mobile browsers render your page at 980px wide and shrink it — making text unreadable on phones.

Frequently asked questions

Why is alt text so important?

Screen readers announce it to blind users, and search engines use it to understand images for image search.

External references

Enjoyed this article?

Share it with a fellow developer or explore more tutorials in our blog.

More articles

Related articles