HTML5 Browser Support

You can teach older browsers to handle HTML5 correctly.

HTML5 is supported in all modern browsers.

In addition, all browsers, old and new, automatically handle unrecognized elements as inline elements.

Because of this, you can “teach” older browsers to handle “unknown” HTML elements.

You can even teach IE6 (Windows XP 2001) how to handle unknown HTML elements.

Define HTML5 Elements as Block Elements
HTML5 defines eight new semantic HTML elements. All these areblock-level elements.

To secure correct behavior in older browsers, you can set the CSS display property to block:

header, section, footer, aside, nav, main, article, figure {
display: block;
}

Adding New Elements to HTML
You can also add any new element to HTML with a browser trick.

This example adds a new element called to HTML, and defines a display style for it:

The JavaScript statement document.createElement(“myHero”) is added, only to satisfy IE.

Problem With Internet Explorer
You could use the solution described above, for all new HTML5 elements, but:

Internet Explorer 8 and earlier, does not allow styling of unknown elements.

Thankfully, Sjoerd Visscher created the “HTML5 Enabling JavaScript”, “the shiv”:

The code above is a comment, but versions previous to IE9 will read it (and understand it).

The Complete Shiv Solution
Example

London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.

Try it Yourself »The link to the shiv code must be placed in the

An HTML5 Skeleton
Example

London
London is the capital city of England. It is the most populous city in the United Kingdom,
with a metropolitan area of over 13 million inhabitants.

Paris
Paris is the capital and most populous city of France.

Tokyo
Tokyo is the capital of Japan, the center of the Greater Tokyo Area,
and the most populous metropolitan area in the world.

Try it Yourself »