HTML has been in continuous evolution since it was introduced to the Internet in the early 90s. Some features were introduced in specifications and others were introduced in software releases. Also, HTML is defined in a way that is backward compatible with the way user agents handle content. HTML5 is a newer version of the HTML coding language. At the same time, it is more advanced, with new features and changes to improve it. For the most part, both are same. If you know how to code in any older versions of HTML, for the most part you should be good in writing HTML5. But HTML5 has several goals which differentiate it from HTML4.
When compared to HTML4, HTML5 aims to be more of an application development platform, which includes not only laying out text and images, but also playing video and audio, interactive 2d and 3d graphics, storing data in the application, dealing with online and offline access to data, and real-time networking protocols for exchanging data as it happens. Both of these are used to in web programming today, although thinking about the future, using HTML5 is suggested.
How HTML5 compares to HTML4
HTML4 lacks rules for parsing, which makes it more difficult for developers to handle errors. It supports what is called 'tag soup', the ability to write malformed code and have it corrected into a valid document. But the problem is that rules for doing this aren't written anywhere, so developers just have to test malformed documents in various web browsers to handle any errors. So, HTML5 is attempting to identify and codify this error handling, so that web browser developers can all standardize and greatly reduce the time and money required to display things consistently.
The syntax in HTML5 is extremely clear and simple as compared to HTML4. One example of this is the DOCTYPE element. To find out which, just check out the DOCTYPE at the top of the HTML document by viewing the source. HTML5 DOCTYPE simply look something like this:
< !DOCTYPE html >
On the other hand, upto HTML4 the DOCTYPE is long and look like this :
< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" > HTML4 Vs HTML5
HTML5 introduces a number of APIs (application programming interfaces) that help in creating Web applications, as follows:
- An API for playing of video and audio which can be used with the new video and audio elements.
- An API that enables offline Web applications.
- An API that allows a Web application to register itself for certain protocols or media types.
- An editing API in combination with a new global content editable attribute.
- A drag & drop API in combination with a draggable attribute.
- An API that exposes the history and allows pages to add to it to prevent breaking the back button.
Finally, HTML4 is the markup language used for develop websites worldwide, and it is supported by all web browsers. Although HTML5 is not yet an official standard, all major browsers support most of its features.