π« 10 HTML Mistakes Beginners Always Make (And How to Fix Them)


HTML may seem simple at first β but for beginners (like I recently was), itβs surprisingly easy to fall into sneaky traps. I made several of these mistakes when I started learning, and chances are, youβre making some of them too.
So hereβs a friendly guide to 10 common HTML mistakes β and how to fix them like a pro. β¨
1. β Forgetting to Close Tags
Many beginners forget to close tags like <p>
, <div>
, or <li>
, which can break the layout or confuse the browser.
β Fix:
Always remember to write closing tags, or use self-closing syntax when needed.
htmlCopyEdit<!-- Wrong -->
<p>This is a paragraph
<!-- Right -->
<p>This is a paragraph</p>
2. β Using <br>
or <div>
Instead of Proper Structure
Using <br>
repeatedly to create space or layout is a big red flag.
β Fix:
Use semantic tags and CSS for structure and spacing.
htmlCopyEdit<!-- Wrong -->
<h1>Hello</h1><br><br><br><p>World</p>
<!-- Right -->
<section>
<h1>Hello</h1>
<p>World</p>
</section>
3. β Not Using Semantic Tags
Many new developers wrap everything in <div>
instead of using meaningful HTML5 semantic tags.
β Fix:
Use tags like <header>
, <nav>
, <article>
, <section>
, and <footer>
to give meaning to your layout.
htmlCopyEdit<!-- Wrong -->
<div class="header">My Site</div>
<!-- Right -->
<header>My Site</header>
4. β Incorrect Nesting of Tags
Putting one tag where it doesnβt belong inside another β like putting a block element inside an inline element β can cause weird results.
β Fix:
Understand which elements can go inside others. For example:
htmlCopyEdit<!-- Wrong -->
<span><div>Hello</div></span> <!-- block inside inline -->
<!-- Right -->
<div><span>Hello</span></div>
5. β Not Using the alt
Attribute for Images
Skipping alt
makes your site less accessible and SEO-friendly.
β Fix:
Always use alt
to describe your image.
htmlCopyEdit<img src="cat.jpg" alt="A sleeping cat" />
6. β Using Inline Styles Everywhere
Hardcoding styles inside HTML makes your code messy and hard to maintain.
β Fix:
Use CSS in a <style>
block or external file.
htmlCopyEdit<!-- Wrong -->
<p style="color: red;">Hello</p>
<!-- Right -->
<style>
.red-text { color: red; }
</style>
<p class="red-text">Hello</p>
7. β Misusing the id
and class
Attributes
Using the same id
multiple times or only relying on class
without understanding their differences.
β Fix:
Use
id
only once per pageUse
class
for reusable styling
8. β Improper Use of Forms
Beginners often forget to link <label>
to <input>
or misuse input types.
β Fix:
Use for
and id
together for accessibility.
htmlCopyEdit<!-- Wrong -->
<label>Name</label>
<input type="text" name="name">
<!-- Right -->
<label for="name">Name</label>
<input type="text" id="name" name="name">
9. β Writing Non-Responsive HTML
Using fixed widths and ignoring mobile devices.
β Fix:
Start thinking mobile-first. Use flexible units like %
, em
, or rem
and set meta viewport
.
htmlCopyEdit<meta name="viewport" content="width=device-width, initial-scale=1.0" />
10. β Copy-Pasting Without Understanding
Using snippets from StackOverflow or tutorials without learning what each tag or attribute does can hold back your progress.
β Fix:
Take a moment to break down the code, test changes, and understand why it works.
π― Conclusion
Everyone makes mistakes when starting out β thatβs how we learn. But by avoiding these 10 common HTML pitfalls, you can build cleaner, more professional, and accessible web pages.
Are you guilty of any of these? Be honest β I was!
π If this helped you, share it with your fellow devs or leave a comment! Follow me for more beginner-friendly web development articles.
Tags:
#HTML #WebDevelopment #LearnToCode #FrontendDevelopment #CodingForBeginners
Subscribe to my newsletter
Read articles from Aditya Patra directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Aditya Patra
Aditya Patra
Final year CS student | Full stack developer | Open source contributor | Linux enthusiast | Learning DSA | Building innovative projects