As a starter or a seasoned web developer, we usually tend to skip out on some great practices that we should be using merely because we have never heard about them. To reduce this gap of missing goodies, we cover several practices no developer should live without.

Doctype Declaration

Many do it, others choose to not. However, it is in your best interest to declare the doctype in your HTML files for better standards compliance. Browsers usually have their own ways to fix errors you accidentally or unknowingly left in to get the HTML better interpreted. However, as with most browsers, they all have different ways to interpret things and thus, when it comes to individual browsers trying to fix or “patch” your errors on the fly, things start to get messy and your website will appear different across these different browsers and platforms.

Therefore, by declaring the doctype, you force these browsers to enter standards compliance mode, which cancels out their correction systems. With this, you can easily locate the errors you have made and be able to fix them to get your website to look and work the same across many browsers and platforms. Think of the doctype as a keycard to open all the doors in a building versus a key that may or may not open a few. You would definitely choose the keycard that opens all the doors rather than a key that may or may not work, the same applies to declaring the doctype so definitely use it, you will be glad you did.

Meta Description Attribute

Many search engine optimization radicals always seem to deter us from using the meta description attribute with the argument that search engines do not use them anymore. Actually, they do, but if they are not available, they will use other means to formulate a description about your website. Therefore, as a good practice, always include a meta description attribute with a great description of the website as this is what search engines use to formulate that description right below your title when you search for your website.

To get back to the search engine optimization radicals, they do have a point, especially for those who misuse the meta description attribute. Search engine bots are getting smarter by the day and can detect whether you deliberately misused the attribute or not. Therefore, use it as intended, as this is a gold mind for HTML as well as the key to improved search engine optimization.

Footer Content

This HTML practice is a bit subjective however very useful and vital to keeping your website running smoothly. We all have landed on a website that takes a good several seconds to a minute to load anything that is viewable due to the cause of external scripts bogging down on the load time. The way HTML is loaded is in sequential form, from top to bottom, line after line. What this means is, it will halt on a line of code until it is fully interpreted or executed, and in this case, it will wait until the external JavaScript file is fully loaded before proceeding on to the next line.

Therefore, stick this JavaScript code in the footer to have the content that is important to load first. For example, if you have your analytics code such as Google analytics, stick it in the footer right before the end of your body tag so that your website can load the content quicker and not bog down until it reaches the end of your content where users do not have to actually wait for it to load.

The reason this idea is subjective is that some may disagree with the idea of taking JavaScript code outside of the head tags, however, in such situations, it is a better practice to take upon as it is what keeps your website running more efficiently in such a case.

Using Unordered Lists for Navigation Bits

Many developers whip up all sorts of concoctions to create a navigation bit. So instead of using the accepted and preferred markup they decide to use a set of divs and all sorts to achieve similar results. This technique is not only inefficient, but it is also very tedious and redundant. Therefore, use unordered lists as a basis for your navigations as the code is simple, the functionality is pretty much completed for you already, and all you need to do is give it some style. Remember, reinventing the wheel is not something you want to do, let alone reinventing it and losing efficiency.

Leaving Your Front Door Open

Whenever you are in your home, out of your home, or on your way home, you always have your doors closed and locked. I mean, who would want to leave their home doors unlocked and open when they are not around? Other than the neighbor I once had who left their front door wide open at night, we all know it is a good practice to keep our windows and doors closed when we are not home. Similarly, always close the tags you open for clean and validated markup.

I have seen countless tutorials out there that are available to teach new developers how to code HTML and they almost always leave their tags open such as image tags or break tags. This not only affects the new generation of developers, but it is a terrible practice. Browsers will always attempt to close them for you causing errors and unwanted results, so save yourself from bad practices, and make closing the HTML tags a habit as you do with closing your doors when you leave your home.

Validate Your Code

Validating your code helps you keep your code clean from nasty errors you may have missed or unintentionally thrown in. While having valid code does not indicate you are a great developer or not, it does help eliminate possible errors you may find in the future within many different browsers and platforms. It additionally throws a good image about your practices for your portfolio for future hires.

  • Pingback: HTML Practices Every Developer Shouldn’t Live Without | Design Shack

  • http://bfred.it bfred.it

    Keep in mind that closing tags is only necessary in XHTML, not always in HTML. Although doing so may save you some hassle, if you really need to save bandwidth the closing tags could be left out when using plain HTML4/5
    Said that, I always close my tags for readability’s sake.

  • http://michael.mior.ca Michael Mior

    You are certainly correct that search engines still use meta descriptions. However, these are often used as a “backup” if an appropriate snippet can’t be found from within the body of the page itself.

  • http://www.crearedesign.co.uk jay pick

    Nice article. Using unordered lists for navigation is also good for seo. I think you could also have included things like building sites using divs (avoiding tables unless necessary) and css optimisation techniques, which are also good practice for developers.

  • http://www.eastdevonit.co.uk Daniel H Pavey

    Good post, thanks

    I like to stick with the UL for navigation too!!

  • http://www.colddesign.it Giacomo Colddesign

    Great and useful article.. thanks..!!

  • Pingback: HTML Practices Every Developer Shouldn’t Live Without | Lively Design Tuts

  • http://mixamash.com ivan

    My pet peeve is the favicon or lack of it on a lot of websites. It is so easy to do and if you can’t get that right then how are you going to handle something more complicated? I won’t use websites without favicons. Not to mention a companies favicon is seen more often than their logo which means in the user eyes it becomes your logo.

  • http://www.buzz-webdesign.co.uk web design hull

    Useful article, good basic checklist… thanks!

  • http://www.justsearching.co.uk Rik @ Just Search

    I think someone’s already touched on it in the comments, but it’s funny that you mention new developers should get in the habit of closing tags properly like XML – the upcoming HTML5 specification allows use of either open or closed tags, with supporting browsers rendering either correctly without errors.

    Saying that I’m personally also a stickler for well-formed code with closing tags :)

  • http://www.curtisscott.com Curtis Scott

    Close those tags… =) I just think it’s good form. Great read, thanks for sharing!

  • http://www.swopper-shop.de Swopper

    A must read for every web developer … Developers must start thinking SEO on every aspect of the development process … great share … thanks :)

  • http://www.xcubelabs.com xcubelabs

    Great points mentioned. Every HTML developers should keep these in mind.

  • http://www.andolasoft.com andolasoft

    Useful information. W3C validation is something which every html designer should have in mind while building a website.

  • jonathan

    html5boilerplate.com

  • jonathan

    so i’ve been using html5boilerplate.com in my websites and he doesnt declare doctypes the way we generally do, did he mean for us to replace the DOCTYPE or is it a html5 feature ?

    PS: dude you should really have a subscribe to comment flag here, i cant keep track!

  • http://www.arohatech.com Ashish Kumar

    Nice article.The points mentioned here are useful for all HTML Developers.Thanks.

  • http://www.speeditonline.com Waqas

    That’s a great article. When making more complex pages I also consider it a good practice to put in comments so that I know which table/div I am closing. Its a great help when trying to modify the code later.

  • http://www.magento-themes.jextn.com Magento Themes

    Excellent source of information for all developers, as HTML is a required and beneficiary part of their life and career.

  • http://muenchen-kueche.de Küchen München

    nice, thank for HTML