That You Should Always Aim To Avoid
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.
- 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.
- 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.
- 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.
- If you want to bold or italicize some text inline, remember to use
<strong>for bold and
<em>for italicizing. There are
<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.
<head>tag. For an example, here’s how you link to a CSS page:
<link rel="stylesheet" href="styles.css">
- Some HTML tags, like
<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.