Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

HTML Best Practices

Tags: practice tags

Always Close Your Tags

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

Best Practice Example

  • Always Close your Tags
  • Always close your tags like this example

Never use inline Styles

This is paragraph Tag

This is paragraph Tag

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.

Best Practice Example

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

small tags

Use H1-H6 tags

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

Best practice Example

hello world

This is heading 2

this is heading 3

this is heading 3

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

  • Home
  • About
  • Contact

All images require “Alt” Attribute

The best practice is use alt keyword when use image

Best Practice Example

Use Meaningful Title

The

tag helps make a web page more meaningful and search-engine friendly.<h4>Best Practice Example</h4><pre lang="html"><title>Learn Html - Web Development and Design Information

Use Descriptive Meta Tags

Meta tags make your web page more meaningful for user agents like search engine spiders.

Best Practice Example

Use Divs to Divide Your Layout into Major Section

It will also help you avoid confusion and excess use of divs, especially if you are writing complex and lengthy markup.

Best Practice Example


Use Field set and Labels in Web Forms:

Use the

. Name a
using

Best Practice Example

Personal Details

Use Practical ID & Class Values

Creating ID and class values can be one of the more difficult parts of writing HTML. These values need to be practical, relating to the content itself, not the style of the content

Best Practice Example

Error! Please try again.

Use proper Class Name

Class names (or values) should be modular and should pertain to content within an element, not appearance, as much as possible

Best Practice Example

alert-message { ... }

The post HTML Best Practices appeared first on The Right Software.



This post first appeared on The Right Software, please read the originial post: here

Share the post

HTML Best Practices

×

Subscribe to The Right Software

Get updates delivered right to your inbox!

Thank you for your subscription

×