Home  >  Article  >  Web Front-end  >  HTML5 browser support

HTML5 browser support

(*-*)浩
(*-*)浩Original
2019-10-23 15:47:352392browse

You can help older browsers process HTML5.

HTML5 browser support

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 523a75af872c9b7da9495f252f14cbcb to HTML, and Define the display style for it:

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What is HTML5?Next article:What is HTML5?