CodesJava

Easy learning with example program codes

User Manual HTML5

Some conventions must be followed while using HTML:

Use a Consistent CSS:

A consistent style must be used while writing an HTML code to make a code simple and easy to understand. A small, clean and well-formed code are always recommended.

Use Correct Document Type:

The document type should be declared at the start of an HTML code. The <!DOCTYPE html> tag can also be used to maintain the lower case practice.

Example:

&lt;!DOCTYPE html&gt;

Use Lower Case Element Names:

In HTML5 it is recommended to use only the lower case letters in element name to avoid mixing of the lower case and upper case letters in elements. The lower case also provides a neat and clean look along with being easy to write.

Example:

Very Bad practice:

<!DOCTYPE html>
<html>
<body>
<ARTICLE>  
<p>Hello World!!</p>  
</article>  
</body>
</html>

Bad practice:

<!DOCTYPE html>
<html>
<body>
<ARTICLE>  
<p>Hello World!!</p>  
</ARTICLE>  
</body>
</html>

Good practice:

<!DOCTYPE html>
<html>
<body>
<article>  
<p>Hello World!!</p>  
</article>  
</body>
</html>

Close all HTML Elements:

Though it is not mandatory but is recommended to close all tags in HTML 5.

Example:

Bad practice:

<!DOCTYPE html>
<html>
<body>
<ARTICLE>  
<p>Hello World!!
</ARTICLE>  
</body>
</html>

Good practice:

<!DOCTYPE html>
<html>
<body>
<article>  
<p>Hello World!!</p>  
</article>  
</body>
</html>

Close empty HTML Elements:

Though it is not mandatory but is recommended to close empty tags in HTML 5.

Example:

Good practice:

<meta charset="utf-8">

<meta charset=”utf-8″>

Don’t Omit <html> and <body> elements:

Though it is not mandatory but is recommended to use both the <html> and <body> elements in HTML 5. The <html> tag is often used to specify the page language.

Example:

Bad practice:

<!DOCTYPE html>
<ARTICLE>  
<p>Hello World!!
</ARTICLE>

Good practice:

<!DOCTYPE html>
<html>
<body>
<article>  
<p>Hello World!!</p>  
</article>  
</body>
</html>
Please follow and like us:
error
Posted in HTML   









Copyright © 2019 CodesJava DMCA.com Protection Status