ArticleDirectory
- 1. Document Type
- 2. Use Position: relative
- 3. Use display: inline
- 4. Do not use annotation nodes
- 5. For the floating effect, remember to use element a with the href attribute.
- 6. Do not use percentage in style settings
- 7. Get the haslayout Element
- 8. strictly abide by the embedding rules of (x) HTML
- 9. Increase Your javascrip level
Although I also really want IE6 to die early, my subjective initiative is too limited. The only thing we can do is to use some means to alleviate the pain brought by IE6.
1. Document Type
Use the strictest document type as much as possible to ensure that your page runs in standard mode. Even if you use them, you may not be able to use many tags, such as B, S, and font, but they can all be replaced by CSS.
<! Doctype HTML public "-// W3C // dtd html 4.01 // en" "http://www.w3.org/TR/html4/strict.dtd">
Or the simplest<! Doctype html ">This is the only document type recognized by html5. the browser will automatically convert it to the one above. Also, do not declare it in the XHTML document. It originally wanted HTML to become a transitional product, but did not know that it was just a rush. When it is used, the element's nodename may be case sensitive and very troublesome.
2. Use Position: relative
In the layout, positioning and then floating layout are always taken into consideration. The floating model of IE is incredibly confusing.
3. Use display: inline
If you must use floating, follow the display: inline. Because IE6 has a very prone bug. You only need to set float and margin values in the same direction as float for the block container elements. For example, if we set float: Left and margin-left: 100px for the DIV element, it will become margin-left: 200px in IE6.
4. Do not use annotation nodes
There are two hateful things involved here. One is a redundant character bug. For more information, see Yang Zhengyi (A 1), the big article "Phantom of the Opera House bug" in this blog.
. The second is the full range of ie api Search bugs. Both document. All, document. getelementsbytagname and document. queryselectorall may return annotation nodes.
5. For the floating effect, remember to use element a with the href attribute.
In ie: hover, this label is only valid for the label, and the href attribute must be explicitly set for this label.
6. Do not use percentage in style settings
An error occurred while calculating the percentage of IE.
7. Get the haslayout Element
For details, please google Baidu, a great academic study on having layout. We can use el. currentstyle. haslayout to check whether it obtains layout. The omnipotent method for obtaining layout is ZOOM: 1.
8. strictly abide by the embedding rules of (x) HTML
Nesting rules are defined in document types. Documents are parsed according to them. Although the current browsers are eye-catching, it is a good idea to prevent them from being nervous. In addition, although some elements are automatically closed, it is very important to keep them closed.
9. Increase Your javascrip level
IE6 is not supported or supports many things well, but almost all of us can simulate it using JavaScript, such as various relational pseudo classes, subelement filtering pseudo classes, attribute pseudo classes, and target pseudo classes, the transparency of Min-width, Max-width, and PNG ......
10. Come and fish on my blog
Calculate an integer. If you find any good things or bugs, I will immediately report them to you ~~~ Pai_^