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

Aditya PatraAditya Patra
3 min read

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 page

  • Use 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

0
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