HTML best practices

At this moment, I want share about best practices how to create good HTML . Lets we try to remember about browser wars, when each browser manufactures  has own standard, they hoped to force out the competition. Developer were difficult because a lot of standard scripts to make good web. For me, its like a dark age, :D..

okeh,, now we must thanks to W3C because they are created a set of language standard creating web. Sure, our topic about html based on W3C standard, because I not have own standard like they browser “devil” manufacture :) ) . if u want to create good html, you must notice several things, i give u little advice for that,

1. Always Declare a Doctype

Why it’s so important? Doctype is A Document Type Declaration, or doctype for short, has traditionally been used to specify which particular flavor of markup a document is written in.

Example doctype for HTML 4.01 :

2. Separate Content from Presentation

Web isn’t created with one programming language, we have minimal 3 to create good job. Example we need a HTML, CSS, and last js.. css can embedded at HTML page according inline, but that’s way not good suggestion, because we write html and css on same document. The best way is, we have to separate each content that nedded from presentation.

3. Place all Externall CSS file within the head tag

  • <head>
  • <title>Example </title>
  • <link rel=”stylesheet” type=”text/css” media=”screen” href=”path/to/file.css” />
  • <link rel=”stylesheet” type=”text/css” media=”screen” href=”path/to/anotherFile.css” />
  • </head>

The reason is while browser show our pages, it takes more faster, because putting stylesheets in the head allows the page to render progressively.

4. Consider Placing Javascript Files at the bottom, before <head> and after you put CSS link, its more easier to understand. :D

5. Use the right HTML Element at the right place :D

6. Write consistently formatted code

Its like pattern, write properly indented clean markup from the start, it will increase your works readability, and very important when you work as team.

7. Vallidate Your Code

W3C has service to make developer can validate code’s. if you offline, we can use a firefox pluggin.

That’s several advice for me, happy programming guys :D ,, enjoy..   the next chapter I will share about drupal and prestashop. :D

Advertisements