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