HTML is the language that all web browsers use to read, interpret and display a website. Right-click on a website and view ‘view source’ will show the HTML for that website. It’s important to incorporate best-coding HTML practices when developing a website, not only will this be easy for a developer to manage, but also search engines will be able to easily index/read your website, which in turn means possible higher rankings. Today, I shall discuss some best HTML practices that all web developers can practice when making a website.
- Closing of tags: It’s best practice to always close HTML tags when developing a website (E.g. <ul></ul>, <p></p>, <li></li>) as this will avoid having validation issues which can affect a website’s readability and indexing.
- Always use the correct DOCTYPE: The DOCTYPE is a method of declaring which best coding standards a website should comply with and what standard of validation that should be used. Below are some standard DOCTYPES:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
- Never use incline CSS styling: I have seen websites that use a lot of inline CSS styling, not only is this messy and hard to read, but also for search engines as well. It’s better to have and use specific classes, ID’s and CSS selectors for the design purposes at hand.
- Insert external CSS files in the HTML HEAD: If external CSS files are being referenced it is best practice to have these files href locations in the head tag. According to Google doing so helps a website load faster.
- Validation and WTC: Always remember to validate a website with W3C mark-up validation service. This website mark-up service has been around for a long time.