In HTML development, beginners often make small mistakes that can affect how a webpage works or looks. Understanding these mistakes helps you write better and cleaner code.
Missing Closing Tags
One common mistake is forgetting to close HTML tags. This can break the structure of the page or cause layout issues.
Example
<p>This is a paragraph <!– Missing closing </p> tag –>
Incorrect Nesting
Tags must be properly nested inside each other. Incorrect nesting can cause unexpected results.
Example of Wrong Nesting
<b><i>Text</b></i>
Using Wrong File Paths
Incorrect image or link paths can lead to broken images or links not working.
Example
<img src=”image.jpg”> If the file is not in the correct location, it will not display.
Not Using Alt Attributes
Forgetting the alt attribute in images affects accessibility and SEO.
Example
<img src=”photo.jpg”>
Overusing Non-Semantic Tags
Using too many div tags instead of semantic tags like header, section, and footer makes code harder to understand.
Not Following Proper Structure
Skipping important structure like doctype, head, or body can cause browser issues.
Example
Always start with: <!DOCTYPE html> <html> <head> </head> <body> </body> </html>
Ignoring Indentation
Poorly formatted code is difficult to read and maintain.
Summary
Common mistakes in HTML include missing tags, incorrect nesting, wrong paths, and poor structure. Avoiding these mistakes helps you write clean, professional, and error-free code.