Copyright © tutorialspoint.com

HTML5 - Quick Guide

previous next


Advertisements

HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web.

The latest versions of Apple Safari, Google Chrome, Mozilla Firefox, and Opera all support many HTML5 features and Internet Explorer 9.0 will also have support for some HTML5 functionality.

New Features:

HTML5 introduces a number of new elements and attributes that helps in building a modern websites. Following are great features introduced in HTML5.

HTML5 Syntax:

The HTML 5 language has a "custom" HTML syntax that is compatible with HTML 4 and XHTML1 documents published on the Web, but is not compatible with the more esoteric SGML features of HTML 4.

HTML 5 does not have the same syntax rules as XHTML where we needed lower case tag names, quoting our attributes,an attribute had to have a value and to close all empty elements.

But HTML5 is coming with lots of flexibility and would support the followings:

The DOCTYPE:

DOCTYPEs in older versions of HTML were longer because the HTML language was SGML based and therefore required a reference to a DTD.

HTML 5 authors would use simple syntax to specify DOCTYPE as follows:

<!DOCTYPE html>

All the above syntax is case-insensitive.

Character Encoding:

HTML 5 authors can use simple syntax to specify Character Encoding as follows:

<meta charset="UTF-8">

All the above syntax is case-insensitive.

HTML5 Elements:

Elements are marked up using start tags and end tags. Tags are delimited using angle brackets with the tag name in between.

The difference between start tags and end tags is that the latter includes a slash before the tag name.

Following is the example of an HTML5 element:

<p>...</p>

HTML5 tag names are case insensitive and may be written in all uppercase or mixed case, although the most common convention is to stick with lowercase.

Most of the elements contain some content like <p>...</p> contains a paragraph. Some elements, however, are forbidden from containing any content at all and these are known as void elements. For example, br, hr, link and meta etc.

Here is a complete list of HTML5 Elements.

HTML5 Attributes:

Elements may contain attributes that are used to set various properties of an element.

Some attributes are defined globally and can be used on any element, while others are defined for specific elements only. All attributes have a name and a value and look like as shown below in the example.

Following is the example of an HTML5 attributes which illustrates how to mark up a div element with an attribute named class using a value of "example":

<div class="example">...</div>

Attributes may only be specified within start tags and must never be used in end tags.

HTML5 attributes are case insensitive and may be written in all uppercase or mixed case, although the most common convention is to stick with lowercase.

Here is a complete list of HTML5 Attributes.

HTML5 Events:

When a user visit your website, they do things like click on text and images and given links, hover over things etc. These are examples of what JavaScript calls events.

We can write our event handlers in Javascript of vbscript and can specify these event handlers as a value of event tag attribute. The HTML5 specification defines various event attributes as listed below:

There are following attributes which can be used to trigger any javascript or vbscript code given as value, when there is any event occurs for any HTM5 element.

Here is a complete list of HTML5 Events.

HTML5 Document:

The following tags have been introduced for better structure:

The markup for an HTM 5 document would look like the following:

<!DOCTYPE html>
<html>
<head>
   <meta charset="utf-8">
   <title>...</title>
</head>
<body>
  <header>...</header>
  <nav>...</nav>
  <article>
    <section>
      ...
    </section>
  </article>
  <aside>...</aside>
  <footer>...</footer>
</body>

To learn this concept - Do Online Practice

I understand you would not be satisfied with this quick guide, so I request to explore HTML5 Tutorial because it is a big change in HTML4 version and can not be covered in a short note.


previous next

Copyright © tutorialspoint.com