Guidelines for a clean HTML code

A good HTML is the base of a beautiful website. A good CSS can only exist with similarly good HTML markup. The advantages of clean, semantic HTML are many, yet lots of websites suffer from badly written markup.

Let’s take a look at some points to improve your written HTML code.

1. Use Strict DOCTYPE for HTML 4.01 or XHTML 1.0

2. Declare Character set just after the opening <head> tag.

3. Use properly encoded Special/funny characters like “&amp;” for “&” instead.

4. Proper indentation of markup for readability of code.

5. Keep your CSS and JavaScript external.

6. Nest your tags properly.

7. Remove unnecessary divs/tags.

8. Use better naming conventions for CSS classes and ids.

9. Leave typography to the CSS (Text uppercase and lowercase etc.)

10. Apply unique class or id to the page content lies in the “body” tag.

11. Use heading tags like <h1>, <h2> etc. for page headings.

12. Validate your code using W3C validator tool.

13. Logical ordering of the sections of your website in code.

14. Just do what you can to make it right.

5 thoughts on “Guidelines for a clean HTML code

  1. Pingback: autocarsinsurance
  2. Pingback: technoscraps

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s