Skip to content
Algol Blog

7 Common Mistakes When Writing HTML Code

Code, HTML2 min read

7 Common Mistakes When Writing HTML Code

Hello everyone, surely you're already familiar with the term HTML (Hyper Text Markup Language). HTML is a very important component in building a website. But did you know, it's not uncommon for people to make mistakes when writing HTML code. In this article, we'll discuss 7 common mistakes when writing HTML code. Check it out!

  1. Forgetting Semantic Header and Footer

    The <div> tag has no semantic structure. So, using the <div> tag should be avoided as much as possible. Specifically for the header and footer sections, HTML already provides dedicated tags you can use.

Example of using header and footer tags
  1. Not Using the Figure Tag

    Images on a website generally have a certain description/caption. However, most people still use the <p> tag to hold that image description. To make your code structure neater and easier to read, you can use the <figure> and <figcaption> tags.

Example of using figure and figcaption tags
  1. Forgetting the Hierarchy of Inline Elements and Block Elements

    Don't write an inline element as a wrapper for a block element. An inline element should ideally not contain more than 1 element value.

Example of using inline elements and block elements
  1. Using the <b> and <i> Tags

    The <b> and <i> tags have no semantic meaning, just like the <div> tag. Therefore, it's best to avoid using these tags. To make text bold or italic, you can style it in a CSS file or use the <strong> or <em> tags instead.

Example of using strong and em tags
  1. Using Inline Styles

    Writing inline styles breaks the principle that HTML structure should be separate from its visual presentation (styling). Writing CSS code in a separate stylesheet file is the best approach.

Example of using inline styles vs non-inline styles
  1. Removing the Focus Outline

    The focus outline is a very important indicator for users who don't use a mouse. Therefore, it's not recommended to remove this indicator. If the default focus outline color clashes with your design colors, you can create a custom CSS style to your liking.

    Tip: Use box-shadow for more flexibility

Example of using box-shadow as a button focus indicator
  1. Not Using Descriptive Links

    Link text should be explicit and clearly convey where the user will be directed. With descriptive text, users and search engines can more easily understand the content you're presenting and its relationship to other pages/sites.

Example of using descriptive text for navigation with the a tag

That concludes 7 common mistakes when writing HTML code. Hopefully this short article helps you avoid mistakes and improve your skills in writing HTML code, so that browsers can better understand the content you present. See you in the next article. Thank you.

© 2026 by Algol Blog. All rights reserved.
Theme by LekoArts