HTML5 support on browsers
You can teach browsers how to handle HTML5 properly.
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
You should read it
- Introduction to HTML5
- HTML editor online
- 6 websites show the power of HTML5
- How to convert from HTML4 to HTML5
- 12 stunning HTML5 templates that web designers should not ignore
- New elements in HTML5
- Computer code element in HTML
- Standard format and code coding convention in HTML5
- Create a quick website with HTML5 Boilerplate
- List in HTML
- HTML5 and CSS3
- Semantic Element in HTML5
Maybe you are interested
Xiaomi Call Ending Error - Thorough Handling Tips Mysterious black objects appear in NASA sun photos 10 strange and interesting facts about the universe you may not have heard of 12 super foods you should have on the menu Scientists are increasingly interested in warp engines, which 'space distortion' technology allows us to travel at the s The interesting scientific knowledge that we missed while at school