Use semantic tags to write your HTML, which is compatible with IE6, 7, and 8

Source: Internet
Author: User

HTML5 adds more semantic tags, such as header, footer, nav ...... When we compile the page, we do not need to use the following method for layout:

<Div class = "header"> This is the header </div> <div class = "content"> This is the intermediate content area </div> <div class = "footer"> This is the bottom </div>

However, you can use this method to deploy:

<Header> This is the header 

However, IE does not support Iot platform forward, so we need to add a little code in js and css to make it support IE6, as shown below:

document.createElement("header");document.createElement("content");document.createElement("footer");

Css:

header,content,footer{display:block}

The above means to customize a label as header and set it to block display. The complete code is attached below:

<! DOCTYPE html> 

Let's talk about something unrelated. Why do we need to write html in semantic form?

First, the code is easy to read. When someone else looks at your code, they can understand it at a Glance. Second, SEO is helpful. Search engine crawlers will largely ignore the markup for performance, focus only on semantic tags.

So hurry up and use semantic tags to write your HTML. What's more, this is not hard, right?

Appendix 1:

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.