HTML Tutorial – Best Practices for web developers

Sponsored

html
html

He i will try to point out some html best practices. Those are not errors but those are essential for a best web programmer who keep best web standards. I always try to achieve these.

Sponsored

Never Forget to Close Your Tags

Some time some tag will come like this

	
  • item one
  • item twoetc..
  • Never Forget to change like them to

    • item one
    • item two

    Some tags like



    is more important use



    always.

    Use Correct Document Type in Header

    we choose these four different doctypes when creating new websites.

    There’s a big debate currently going on about which is the  correct choice here. In some time xhtml strict is adviced best but now a days it switch back to HTML – The coming on HTML 5 will change all these type to simple html. Select correct type of your website.

    Move Your Styles to A CSS Sheet. Dont go for inline

    It is easy and harmless using inline styles when coding. But it will point the bad practice

    like

    Some text

    will be easy. But consider create a class for that and put them in css sheets. Which will defenitly improve performance.

    Include All Your CSS Sheets in HEAD

    We Can  include of style sheet anywhere in the web page there is no problem with that. 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

    The Media screen means this stylesheet work only for screen. It is best to include a style sheet for print also. If you want a same sheet for screen and print go for all.

    Place All Javascript Includes in the bottom of the page

    the primary goal is to make the page load as quickly as possible for the user. When loading a javascript, 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 in the page load.

    This is the end of footer.p>%MINIFYHTMLdf19a0e06d36aab0398c1e3fe099bdc010% 
    
    

    Dont use inline Javascript

    the onclick propery of button or input invoke a javascript function. But now a days it is changed to add a listner in an external file and then add the javascript code there. Jquery will help you to do this. It benefits the chances for getting errors and abnormal page load termination.

    $('a#MyLink').click(function() {  
    
      alert('Want to go to a link?'); 
    
    });
    

    All Tag names in Lower Case Only

    something

    this is the old fashion HTML. But now a days nobody using this.

    go for XHTML style. It looks beautiful works beautiful and typing capital letters is a real bad thing.

    go for

    something

    Use All kind of Heading Tags like h1,h2,h3...h6

    It is best to use all 6 heading levels where needed. Commonly the first three is there. But the other three help you to categorise content very effective to a search engines.

    Add Alt atribute to all Img tags

    it is best use alt tag for images. if time taken to load image or image is not available for some reason it is best to place a text for information.
    Bad Practice

    
    

    Seems Better

    A Photo of My.
    

    Validate Continuously

    validation should work for you, not against. Continuously validate your html and css in w3c. It will give correct direction how to code. I will help to follow best practices in coding.

    Happy Coding..........!!!

    Sponsored

    1 thought on “HTML Tutorial – Best Practices for web developers”

    Leave a Comment

    Your email address will not be published. Required fields are marked *