What I Wish I Knew Before Writing HTML

Cartoon illustration of a student coding HTML on a desktop computer with semantic HTML tags on screen

Cartoon illustration of a student coding HTML on a desktop computer with semantic HTML tags on screen

Just getting started with HTML? Here are the beginner mistakes I made (so you don’t have to), from semantic tags to alt text and clean structure.

Learning HTML the Hard Way

When I first started learning HTML, it was super straightforward. You know—throw a few tags on the page, hit refresh, and boom, a working website. But it did not take long before things started falling apart. I had no idea why screen readers were not picking up any of my content. I would mess up my previous changes to clean up the style and structure, and the new section of code would also be affected. That’s when it hit me: writing HTML is easy to start, but tough to do right.

If you’re just getting into it, here are a few things I really wish I had known from the start.

Semantic HTML Is a Lifesaver

Initially, I used the <div> and <p> tags for almost everything. It worked, but my code was messy and complicated to read. Then I discovered semantic HTML—tags like <header>, <nav>, <main>, and <article> that describe what each part of the page does.

Not only does this make your code way easier to manage, but it also helps screen readers and search engines understand your site. This helps structure your website and code in an orderly manner and have specific style guides for each section.

Cartoon-style diagram comparing two HTML structures side by side, with one using nested <div> elements and the other using simplified semantic layout, separated by an equals sign

Indentation and Nesting Keep You Sane

At first, I didn’t care about spacing or indentation—big mistake. When you start adding multiple elements inside one another, bad nesting turns your code into a headache. While coding, I have often encountered situations where I did not properly indent or leave space between my code and each section I was working on. As a result, I had to spend hours debugging, and I found that it was either a minor spelling mistake or I had used the wrong closing tag. Clean indentation has saved me so many times when something wasn’t working and I had to debug it.

 

Not Clean HTML Code:

Cartoon illustration of a developer writing messy HTML code on a monitor, with no indentation, spacing errors, and misspelled tags like <seccction> and <lg=9991>

 

Clean HTML Code:

Cartoon illustration of a young developer writing clean, well-indented HTML code on a desktop computer screen using semantic tags like <section> and <footer>

 

Alt Text Is Actually Important

Honestly? I used to skip writing alt text because I thought it didn’t matter. Now I know it’s a big deal—for accessibility, for SEO, and people using screen readers. Alt tags are great for accessibility features that the web offers. I did not realize that it would make a significant difference if I did not add alt tags, but after conducting further research, discussing with my peers, and experimenting on my own, I found that they are indeed important. It’s a tiny detail that makes your site more inclusive and easier to find.

Here’s a quick example of what I use now:

Cartoon-style illustration of HTML code displayed in a text editor, highlighting an anchor tag with an image element that includes a descriptive alt attribute

📢 What About You?

Just starting out with HTML? Been there. Share your favorite trick or biggest mistake in the comments—I’d love to hear how your learning is going!

Author: opate22

Leave a Reply

Your email address will not be published. Required fields are marked *