HTML 4 vs HTML 5
HTML 4 and HTML 5 are two versions of the Hypertext Mark-up Language known in short as HTML. It is basically used to create static web pages. Different versions of HTML have been released over the years and the latest one is HTML 5. There are certain differences between HTML 4 and HTML 5.
The version 4 of HTML supports features such as scripting, richer tables, style sheets, embedding objects, improved support for mixed and right to left direction text. The accessibility for disabled people is also improved with the enhancements for forms.
HTML 4 has been designed with the assistance of experts in internationalization so that the documents can be transported easily and also can be written in different languages. This is achieved with the incorporation of RFC2070.
Various new features have been added to HTML 4 especially for the people with limitations:
• Better distinction between presentation and document structure. This encourages the use of style sheets rather than HTML attributes and presentation elements.
• An object can have a text description using the markup.
• Access keys addition, active labels and better forms.
• Addition of MAP element or image map mechanism and that too on client side.
• Support for lang and title attributes for all the elements.
• Long descriptions of images, frames and tables etc.
• Wide variety of target media so that it can be used with style sheets.
• Better captions, tables, mechanisms and column groups.
HTML 5 is the latest version of HTML. In 2004, HTML was developed by W3C but after that they focused more on XHTML and XML. So, a new group named WHATWG or Web Hypertext Application Technology Working Group was formed and it worked on HTML 5.
This version of HTML is focused on the requirements of developers who make web application and it also addresses the issues faced in the previous version of HTML.
Although there has been no finalization regarding the specification of HTML 5 but there are some elements that can be used provided your browser supports it. For example, the canvas element is used to draw graphics along with scripting. This element is supported by IE 8, Firefox, Opera and Safari.
Since it is the newest specification, many browsers will support it in near future. The best thing about HTML 5 is that it is backward compatible. If you are a web application developer then you may want to learn HTML 5 because it supports various tags and attributes for applications. For example, some new event handlers in HTML 5 are ondrag, ondrop, ondragstart and ondragend.
Difference between HTML 4 and HTML 5
• The error handling has been codified and rediscovered completely on HTML 5. This helps browser developers to standardize and reduce time as well as money to show the things in a consistent manner on a web page. This is not possible in HTML 4.
• New elements have also been added to HTML 5 such as <header>, <section>, <article> etc which were not present in the previous version. This makes the pages more semantic as well as much easier to read.