HTML5 User Manual

HTML Coding Convention

You should follow some convention while using HTML:

Use a Consistent CSS

A user must use consistent style while writing HTML. It makes the code simpler and more understandable for people.

Your code must be small, clean and well-formed.

Use Correct Document Type

You should declare document type at the starting of your code.

For example:

You can also use to maintain your lower case practice.

Use Lower Case Element Names

HTML5 facilitates you to use upper case and lower case letters in element name. But it is good practice to use only lower case. Because:

  • Mixing lower case and upper case letters in elements is not a good idea.
  • Lowercase looks neat and clean.
  • Lower case is easy to write.
  • Developers mainly use lower case letters.

Example:

Bad practice:

Note: This example will run but it is not a good practice to write elements in uppercase letters.

Very Bad practice:

Good practice:

Close all HTML Elements

In HTML5, it is not required to close all HTML tags. But, it is recommended to close tags.

Bad practice:

Good practice:

Close empty HTML Elements

In HTML5, it is not mandatory to close empty HTML tags. You can close it or let it be unclosed.

Good practice:

Don't Omit and

HTML5 facilitates you to omit and tag. You can exclude both tags and the program will work well enough.

Example:

Test it Now

We recommend you to not to omit and tag because is a root element and specifies the page language.

Syntax:

Example:

Test it Now
Next TopicHTML5 Tags




Contact US

Email:[email protected]

HTML5 User Manual
10/30