Post

HTML Best Practices

Always test your website or application against these HTML validations. These HTML best practices are important and will add value to your product.

   
HTML Best Practices
At The Right Software, we take pride in writing proper code (software development the right way) and as such it starts with HTML as our end product. That is why we have setup these best practices to write proper HTML following these best practices. Your developer should be well aware of these as well as use them all in your software product.

Always Close Your Tags

Always close your tags otherwise you will get validation Issues everytime.

Always Close your Tags

Always close your tags. Its important when you are copying code to check. Most IDEs now provide support to check closing tags smartly. We recommend to use SublimeText or Notepad++ for writing HTML.

Never use inline Styles

This is paragraph Tag.

This is paragraph Tag

Best is to use HTML’s style tag very sparingly. CSS libraries are very configurable now with LESS and SASS.

Best Practice Example

Better practice is
p{
Color:red;
}

Always Use CSS files Under head tag

you can place stylesheets anywhere you like. However, the HTML specification recommends that they be placed within the document HEAD tag. The primary benefit is that your pages will seemingly load faster.

Place JavaScript files at the bottom of page

the primary goal is to make the page load as quickly as possible for the user. When loading a script, the browser can’t continue on until the entire file has been loaded. Thus, the user will have to wait longer before noticing any progress.

Best Practice Example

this is last paragraph of page

Keep your tag name in lowercase

Technically, you can get away with capitalizing your tag names.

Best Practice Example

At The Right Software, we take pride in writing proper code (software development the right way) and as such it starts with HTML as our end product. That is why we have setup these best practices to write proper HTML following these best practices. Your developer should be well aware of these as well as use them all in your software product.

Always Close Your Tags

Always close your tags otherwise you will get validation Issues everytime.

Always Close your Tags

Always close your tags. Its important when you are copying code to check. Most IDEs now provide support to check closing tags smartly. We recommend to use SublimeText or Notepad++ for writing HTML.

Never use inline Styles

This is paragraph Tag.

This is paragraph Tag

Best is to use HTML’s style tag very sparingly. CSS libraries are very configurable now with LESS and SASS.

Best Practice Example

Better practice is
p{
Color:red;
}

Always Use CSS files Under head tag

you can place stylesheets anywhere you like. However, the HTML specification recommends that they be placed within the document HEAD tag. The primary benefit is that your pages will seemingly load faster.

Place JavaScript files at the bottom of page

the primary goal is to make the page load as quickly as possible for the user. When loading a script, the browser can’t continue on until the entire file has been loaded. Thus, the user will have to wait longer before noticing any progress.

Best Practice Example

this is last paragraph of page

Keep your tag name in lowercase

Technically, you can get away with capitalizing your tag names.

Best Practice Example

<div>small tags</div>

Use H1-H6 tags

It is best practice that you use all these heading tags.

Best practice Example

<h1>hello world</h1>

<h2>This is heading 2</h2>

<h3>this is heading 3</h3>

<h3>this is heading 3</h3>

Wrap Navigation with an Unorder List

Each and every website has a navigation section of some sort. While you can definitely get away with formatting it like so

Best Practice Example

<ul>
 <li style="list-style-type: none;">
<ul>
 <li style="list-style-type: none;">
<ul>
 <li style="list-style-type: none;">
<ul>
<li><a href="#">Home</a></li>
</ul>
</li>
</ul>

</li>
</ul>
</li>
</ul>


<ul>
 <li style="list-style-type: none;">
<ul>
 <li style="list-style-type: none;">
<ul>
 <li style="list-style-type: none;">
<ul>
<li><a href="#">About</a></li>
</ul>
</li>
</ul>

</li>
</ul>
</li>
</ul>

<ul>
 <li style="list-style-type: none;">
<ul>
 <li style="list-style-type: none;">
<ul>
 <li style="list-style-type: none;">
<ul>
 <li><a href="#">Contact</a></li>
</ul>
</li>
</ul>

</li>
</ul>
</li>
</ul>

All images require “Alt” Attribute

The best practice is use alt keyword when use image

Best Practice Example

<img src="cornImage.jpg" alt="A corn field I visited." />