Use semantic tags to write your HTML, compatible with IE6, and semantic ie6

Source: Internet
Author: User

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

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. </header><content> This is the intermediate content area. </content><footer> This is the bottom. </footer>

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><html><head><meta charset="utf-8"><title> Use semantic tags to write your HTML, which is compatible with IE6, 7, and 8 </title><style>*{margin:0;padding:0;}header,content,footer{display:block}header{width:600px;height:150px;line-height:150px;border:1px solid #000;margin:10px auto;text-align:center;font-size:24px}content{width:600px;height:250px;line-height:250px;border:1px solid #000;margin:10px auto;text-align:center;font-size:24px}footer{width:600px;height:150px;line-height:150px;border:1px solid #000;margin:10px auto;text-align:center;font-size:24px}</style><script type="text/javascript">document.createElement("header");document.createElement("content");document.createElement("footer");</script></head> <body><header> This is the header. </header><content> This is the intermediate content area. </content><footer> This is the bottom. </footer></body></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:

HoorayOS-WEB desktop application framework is a well-received Web desktop application framework. You can use it to develop desktop application websites such as Q + Web, you can also develop a desktop management system for various projects. Official Website: http://hoorayos.com/classification: front-end technical tags: css, js, html5, semantic, tags, header, footer

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.