5 New Features in HTML5

This tutorial explains the 5 new features introduced in the HTML5. The features are new doctype, importing scripts and resources, image element tag, canvas element and the offline or local storage in the browser. There are many other great features in the HTML5, here I just give the overview of these 5 new features.

1. New Doctype

HTML5 has introduced the new doctype with minimal code. The old doctype reads as :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

The new doctype is

<!DOCTYPE html>

2. No More Types for Scripts and Links

When you import scripts or style sheets we have to specify the type of the resources as the extra attribute.

<link rel="stylesheet" href="theme.css" type="text/css" />
<script type="text/javascript" src="javascript.js"></script>

These attributes are no longer necessary for HTML5 web pages. You can import the resources without specifying the types.

<link rel="stylesheet" href="theme.css"/>
<script src="javascript.js"></script>

3. The Figure Element

The old markup for image is

<img src="image" alt="Image Text" />

If you look at the above tag, there is no way to give the caption to an image and associate it. Only way is to add using the separate paragraph tag. With the HTML5’s new element figure, one can easily provide the semantic caption to an image.

	<img src="image" alt="Image Text" />
		<p>Sample Caption Text</p>

4. Canvas Element in HTML5

Read: Canvas Tag in HTML5

HTML5 element canvas gives you an easy and powerful way to draw graphics using JavaScript. It can be used to draw graphs, make photo compositions or do simple (and not so simple) animations. This is one of the greatest feature in the HTML5.

<canvas id="mycanvas" width="100" height="100"></canvas>


   border:1px solid red;
   <canvas id="mycanvas" width="100" height="100"></canvas>


It is very simple example of using the canvas element.

5. Local Storage

A major improvement in HTML5 is the local storage in the browser. . It allows an online application to work even if the user loses or disconnects their internet connection. For example, you would be able to compose a message in your webmail client even if you couldn’t find a WI-FI hotspot nearby.

Read : A Simple Offline Web Application using HTML5

Leave a Reply

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

Pin It on Pinterest

Share This

Share this post with your friends!