To succeed in a competitive online world, website performance is crucial. Here is the list of HTML structural mistakes that should be avoided for optimal results.
To be in the race, the developer should write the HTML as per standards. Here is the list of areas where the major mistakes are happening and if we take care of these things at the initial stages of development for damn sure our site will reach our audience.
1. Not maintaining proper HTML document structure
If we have a good document structure, then with fewer efforts of CSS we can achieve the goal of a perfect website. For that, we need to keep a few points while writing the HTML document structure.
- We should not miss the type of document
- Lang attribute should be must
Here is a perfect example of proper html document structure
Correct |
Wrong |
|
1.
2.
3.
|
2. Head tag structure
The only allowed things in the head tag are meta info of the website, title of the document, external CSS, JS, files that can be linked, cdn’s like jquery, font awesome icons related info can be given. No other html elements or tags are allowed in the head tag. Here is a simple example.
Correct |
Wrong |
|
1.
2.
|
3. Worst structure of the body
Standard body structure could be header, main, and footer. All the site navigation links and logo should be the header. All the main page content should be in the main tag and the copyrights info, social login details, and contact details should be in the footer tag. Here is an example of the basic structure of the body.
Correct |
Wrong |
|
1.
2.
3.
|
4. Missing heading hierarchy
As we are living in the fastest-growing technological world, we must upgrade to new technologies. Modern HTML, that is HTML5 is updated with certain standards and one of them is heading hierarchy. Here is the ruleset.
- Every individual page on a website should have only one H1 tag
- Every page should start with H1 and then be followed by H2, H3, H4, H5, and H6
- A website having a page without heading tags is not SEO friendly
Correct |
Wrong |
|
1.
2.
3.
|
5. Block elements are not allowed as a child element of inline elements
Inline elements can never be the parent elements for block elements. For example, div is a block element and span is an inline element so div within span is not allowed. Checkout for all the inline elements and block elements here.
This type of structure is not allowed
<span>
<div></div>
</span>
6. Proper closing tags
We should maintain proper opening and closing tags else we can face the breakdown of entire site structure.
<div> <!-- opening of first div -->
<div> <!-- opening of second div -->
<div> <!-- opening of third div -->
<p></p>
<span></span>
</div> <!-- closing of second div -->
</div> <!-- closing of first div →
In the above example, for the first two divs, the closing tags are given but not for the third opened div, this will break the entire structure. When it comes to the ‘p’ tag the opening tag is written in small letters and the closing tag is written in caps. This is not allowed both opening and closing tags should be small.
7. Not using responsive images
We should maintain the images as compatible with the screen resolutions and that can be achieved through responsive images. Some of the major CMS like drupal have the responsive image module as core modules. We should not use particular width and height for an image and those values should be either 100% or auto.
Correct |
Wrong |
|
|
8. Missing alt tags
Alternative text for image tags has a purpose and the alt text will describe the image which could be helpful to the screenreaders. So never miss the alt text and do not give some render text over there, the text should be descriptive. Here are the examples.
Correct |
Wrong |
|
|
9. Using deprecated HTML Attributes
Some deprecated HTML like using the link in body and object tag, applying width for <hr>,<pre>,<td>,<th> will make your site performance down.
10. Improper usage of the ‘p’ tag
In HTML, for every element, there is a specific purpose if it img tag, we can use it only for the images and icons. The ‘p’ tag also has a specific purpose. If you are giving some text in the p tag, the browser will understand that it is a paragraph. So never use a p tag for sub-titles, and bookmarks, using a tag in p is only meant for paragraphs.
Correct |
Wrong |
|
|
12. Line breaks should be avoided
Avoid line breaks (<br>) to display the things in the next line and also multiple <br> is not allowed for generating space between elements.
Correct |
Wrong |
|
|
13. Avoid inline styles
As HTML is meant only for markup, we should avoid using the below-listed tags and inline styles in the markup which could be managed through CSS for the websites.
- <strong>
- <i>
- <b>
- Border attributes in any HTML tag
- <blink>
- <marquee>
This type of error will down the site's performance and will be given a less rank.
14. Improper navigation structure
Where ever the site navigation occurs, in any area like in the header, sidebar, aside tag, or in the footer, the standard structure should be as given below.
Correct |
Wrong |
1.
2.
|
1.
2.
3.
4.
5.
|
We should follow this structure because our site should be keyboard accessible along with SEO-friendly.
Conclusion:
If we take care of all the above-mentioned things at the initial stage, you can able to create a stunning website with the max percentage of performance. Hope you got sufficient info for your requirement. Thanks for reading.
Comments