Six Common HTML Mistakes

That You Should Always Aim To Avoid

Computer monitor with HTML code on it.

HTML is an essential language to learn when doing web development, but there are many mistakes beginner, sometimes even experienced, devs make. These mistakes are most often very simple and easy to miss, which is why they are so common.

I just wanted to write this blog to help you catch on to six of the most common mistakes.

  1. Whenever you have an image on a webpage, you must make sure to add a sentence describing the image to the <img> tag. This helps vision impaired users to know what that image is when using a screen reader.
  2. There are attributes available to you in HTML which allow you to style aspects of the webpage in-line. Don’t do this. That is what CSS pages are there for; to keep the, often text-heavy, styling to a completely separate page. Without this your HTML would be much longer and much harder to read.
  3. Never forget to declare <!DOCTYPE html> . This is a message to the browser being used about what kind of document this is. Not declaring this, or having it in the wrong spot (it’s meant to be the very first thing in a HTML document) could have the browser interpreting the document in unforseen ways.
  4. If you want to bold or italicize some text inline, remember to use <strong> for bold and <em> for italicizing. There are <b> and <i> tags which seemingly do the same thing, but they are not semantic. This means they only change the text visually, it does not carry any emphasization (which is what bolding and italicizing is meant for) to the webpage.
  5. So you’ve put a bunch of work into your CSS and Javascript documents and they are in the correct folder, but they’re not changing the webpage? Probably because you forgot to link them in the <head> tag. For an example, here’s how you link to a CSS page: <link rel="stylesheet" href="styles.css">
  6. Some HTML tags, like <img> and <br> tags, which do not need to have closing tags, but the majority do. If you do not close the tags they’ll straight up not work. If something’s not working or showing up as it should, check to make sure you’ve closed the proper tags.

Oftentimes it’s the simplest things that are missed and those mistakes can cause us to scratch our heads. But if you keep these tips in mind, you’ll likely be able to catch the mistakes quicker, saving you time for the big bugs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store