HTML5 support on browsers

You can teach browsers how to handle HTML5 properly.

Browser supports HTML5

HTML5 is supported on most modern browsers. Browsers, whether new or old, automatically handle elements that they don't know as an inline element. Therefore, you need to 'teach' it to know how to handle new HTML elements. Even IE6 (on Windows XP 2001) can "teach" it.

Define syntax elements for block elements

HTML defines 8 new syntax elements, all at the block level. To ensure correct display on the old browser, you can set the display properties for these elements to the form of blocks.

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

Add new elements to HTML

You can also add new elements to the HTML page, as the example below adds a named element and defines its style.









Title


Phần tử myHero


Use the JavaScript command document.createElement ('myHero') to create new elements on IE9 and earlier versions.

Problems with Internet Explorer 8

It is possible to use the above solution for all new HTML5 elements. But IE8 and earlier versions do not allow styling on elements it does not know.

So Sjoerd Visscher created HTML5Shiv. This is a JavaScript alternative, allowing styling for HTML5 elements on IE 8 and earlier versions.

HTML5Shiv syntax

HTML5Shiv is placed in the tag, which is the JavaScript file referenced in the tag

Example of HTML5Shiv

If you do not want to download and store HTML5Shiv on your site, you can refer to the version on the CDN page. The HTML5Shiv script must be placed in the element.











Technology page




Network administrator


Network administration is the technology site, providing the latest technology guides, tips and news.






Link download HTML5Shiv https://github.com/aFarkas/html5shiv or refer to CDN version https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js

Previous article: Introduction to HTML5

The following article: New elements in HTML5

4 ★ | 1 Vote

May be interested

  • Internet Explorer 9 overcomes competitorsInternet Explorer 9 overcomes competitors
    ie9 (only for vista and windows 7) also introduces a host of other utilities, such as html5 support, windows 7 integration, a multitasking address bar and more.
  • Enable JavaScript in browsersEnable JavaScript in browsers
    all modern browsers come with support available for javascript. often, you may need to manipulate to enable or disable this support. this chapter explains the procedure to enable and disable javascript support in your browser: internet explorer, firefox, chrome, and opera.
  • Standard format and code coding convention in HTML5Standard format and code coding convention in HTML5
    html5 has a free way to write, so to become a smart programmer, you need to create your own habit of writing the code properly so that others can easily understand and use your html code. find out with quantrimang.
  • 5 web browsers support Dark Mode / Night Mode for Android phones5 web browsers support Dark Mode / Night Mode for Android phones
    using applications that support the dark interface, night mode is really necessary, it will help us reduce the negative effects on the eyes. and in this article, network administrator will share with you 5 web browsers for android phones that support dark mode / night mode.
  • HTML5 and CSS3HTML5 and CSS3
    basically, html pages are like skeletons - the basic framework - of a web page - while css files will specify how the elements of a page should be displayed.
  • Learn about Appear.inLearn about Appear.in
    appear.in is a sophisticated, intuitive and beautiful application, based on the google hangouts model. only html5. no flash. no plugins. no registration. there are no bullshit.
  • Opera released Opera 16 based on Chromium 29Opera released Opera 16 based on Chromium 29
    opera recently officially released a stable version of opera 16 web browser using chromium 29 engine with many new enhancements related to api utilities and added support for location recognition service.
  • Google blacklisted some web browsers on Linux, blocking access to Google servicesGoogle blacklisted some web browsers on Linux, blocking access to Google services
    google has issued a notice banning a number of popular linux browsers from signing in to its services.
  • Canvas element in HTML5Canvas element in HTML5
    the element is used to draw simple word graphic elements such as lines to complex graphics (lines, boxes, circles, lettering, image insertion ...). however, one thing in particular is that its content is built from javascript.
  • Chrome and Firefox can 'chat' with each otherChrome and Firefox can 'chat' with each other
    chrome and firefox engineers have just developed a new html5 protocol, to help users of these two browsers can make video conversations with each other without having to install any more applications. come on.