Recognize html5 tags in IE6/7/8

Source: Internet
Author: User

Recognize html5 tags:

Html5 adds many semantic tags, such as <nav> </nav>, <aside> </aside>, and <article> </article>, when I saw these labels, I thought html5 was not supported by many old-fashioned ie browsers, and I didn't pay much attention to them. This morning, I saw a discussion about these labels in the group, and I suddenly had a question, I can use these labels in chrome and other modern browsers, so what will happen if I use these labels in IE6/7/8. So we immediately started the test.

        Document    nav    aside

The results have come out. You don't have to think about these browsers that do not recognize these labels, so there is just a line of text: nav aside;

In modern browsers, these two are normal block-level labels, so there is a line feed.

I tried to add a style to the labels of nav and aside.

{:;}{:;}

Naturally, this is not the case. I will add a class and a style. Similarly, a failure is declared.

I searched the internet for the reason that those old-fashioned browsers did not have these labels at the root of their birth, and naturally did not recognize them. There are also some solutions, that is, add the following script in the head to let the browser identify this as a tag, so that css can be rendered smoothly.

document.createElement("nav""aside");

However, after writing this, the font color is changed and it is still an inline element. All the styles must be defined as display: block,some csscodes are already available in reset.css.

To support all newly added html5 tags, you can write

 i = 0, html5tag = ["aside", "figcaption", "figure", "footer", "header", "hgroup", "nav", "section"(i 

There are also writing

This html5.js feature should be more powerful, not just as simple as making old browsers recognize html5 tags.

Lenovo: Custom tags

Since these html5 labels are "Strangers" for old browsers, the tags we create are also strangers, so I added a line of code.

myyou
{:;}{:;}

What's amazing is that chrome, FF, and safari can recognize and add styles.

However, in IE, createElement must be created before identification.

Html5 DOCTYPE:

I used to think that the line in html5 is concise. <! Doctype html> the document header can only be used in browsers that support html5. Today, I checked the document and found that it was a big mistake. I didn't have enough understanding of the document header. This is backward compatible. The brief DOCTYPE Statement of HTML5 enables modern browsers such as Firefox and Chrome and IE6/7/8 to enter the standard mode, you may wonder that IE6/7 can also support HTML5 Doctype. In fact, IE enters the standard mode as long as the doctype complies with this format.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.