You can help older browsers process HTML5.
HTML5 Browser Support
All modern browsers support HTML5. (Recommended learning: html tutorial)
In addition, all browsers, old and new, will automatically treat unrecognized elements as inline elements.
Because of this, you can help older browsers handle "unknown" HTML elements.
Note: You can even teach Stone Age IE6 how to handle unknown HTML elements.
Defining HTML5 elements as block-level elements
HTML5 defines eight new semantic HTML elements. All are block-level elements.
You can set the CSS display property to block to ensure correct behavior in older browsers:
Example
header, section, footer, aside, nav, main, article, figure { display: block; }
Ask HTML Adding New Elements
You can add any new element to HTML via browser tricks:
This example adds a new element named
Instance
<!DOCTYPE html> <html> <head> <title>Creating an HTML Element</title> <script>document.createElement("myHero")</script> <style> myHero { display: block; background-color: #ddd; padding: 50px; font-size: 30px; } </style> </head> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> <myHero>My First Hero</myHero> </body> </html>
The above is the detailed content of HTML5 browser support. For more information, please follow other related articles on the PHP Chinese website!