As you learn HTML, it’s common to make mistakes. But don’t worry, we’ve all been there! Here are some of the most common mistakes made by beginners and how to fix them.
Not closing tags:
Every HTML tag needs to be closed, except for self-closing tags like <br> and <img>. Make sure to always close your tags, like this: <p>This is a paragraph</p>
Using uppercase tags:
HTML is not case sensitive, but it’s generally accepted to use lowercase tags. It’s easier to read and looks cleaner. So instead of <P>, use <p>.
Forgetting the <!DOCTYPE html> declaration:
This tells the browser which version of HTML you are using. Without it, the browser may not know how to interpret your code. Make sure to include it at the top of every HTML document.
Not nesting tags correctly:
HTML tags should be nested inside each other in a logical order. For example, an <li> (list item) should be inside a <ul> (unordered list) or <ol> (ordered list).
Not using quotes around attribute values:
Attribute values should always be in quotes. For example, <img src=”image.jpg”> is correct, but <img src=image.jpg> is not.
Using inline styles instead of CSS:
It’s generally a good practice to separate your HTML and CSS. Instead of using the style attribute to style an element, use a separate CSS file or include your styles in the <head> of your HTML document using a <style> tag.
Misusing the <table> element:
The <table> element should only be used for tabular data, not for layout. Use CSS to style and position elements on your page.
Not using alt text for images:
Alt text is important for accessibility and SEO. It describes the content of an image to people who can’t see it, and it’s also used by search engines to understand what an image is about. Always include alt text for your images like this: <img src=”image.jpg” alt=”Description of image”>
Not using semantic elements:
HTML has many semantic elements that describe the content of a page, such as <header>, <footer>, and <article>. Using these elements helps search engines understand the content of your page and makes it more accessible to screen readers.
Not testing your code:
Always test your HTML code to make sure it’s working as expected. Use a tool like the browser’s developer console or a validation service like W3C Markup Validation Service to catch mistakes and ensure your code is valid.
HTML Full Tutorial For Beginners !!!Click to Learn More about – HTML Tutorial for beginners