Various browsers CSS hack

Source: Internet
Author: User

When you write CSS, add the browser identifier to the style sheet. The differences between different browsers are as follows:

Ie can recognize *, but standard browsers (such as ff) cannot recognize *;
IE6 can recognize *, but cannot recognize it! Important;
IE7 can recognize * and can also recognize! Important;
IE8 can recognize \ 0, cannot recognize *, +, _, * +! Important;
FF cannot recognize *, but can recognize it! Important;
For example, style = "* width: 10px! Important; width: 20px ;"
In this way, the width of IE6 is 10px, and the width of IE7 is 20px.

There are three other methods:

One type:
Width: 100px;/* Firefox and other browsers */
Width: 200px \ 0;/* IE8 can recognize \ 0 */
* Width: 300px! Important;/*, IE7 can recognize both * and important */
* Width: 400px;/* IE6 can recognize */
/* Pay attention to the sequence */

Two types:
Width: 100px;/* Firefox and other browsers */
Width: 200px \ 0;/* IE8 can recognize \ 0 */
* Width: 300px;/* IE7 can recognize */
_ Width: 400px;/* IE6 can recognize underlines */
/* Pay attention to the sequence */

Three types:
Width: 100px;/* Firefox and other browsers */
Width: 200px \ 0;/* IE8 can recognize \ 0 */
+ Width: 300px;/* + only recognizes IE7 */
_ Width: 400px;/* IE6 can recognize underlines */
/* Pay attention to the sequence */

1 .. color1 {color: # f00; color/* \ **/: # 00f/* \ **/}/* IE6, IE7, IE8, FF, op, sa recognition */
2 .. color2 {color: # f00; color/* \ **/: # 00f/* \ 9 **/}/* IE7, IE8, FF, op, sa recognition */
3. color3 {color: # f00; color/* \ **/: # 00f \ 9}/* IE6, IE7, IE8 recognition */
4 .. color4 {color: # f00; color/* \ **/: # 00f \ 9}/* IE7, IE8 recognition * // * There is a space between "color" and */
OP indicates opera, sa indicates Safari
-------------
Hack supported by various browsers:
Width: 100px \ 0;/* supports IE8 */

_ Width: 100px;/* supports IE6 */

[Width: 100px;/* supports IE6, 7 */

+ Width: 100px;/* supports IE6, 7 */

* Width: 100px;/* supports IE6, 7 */

* Width: 100px! Important;/* supports IE6, 7 ,*/

* + Width: 100px;/* supports IE6, 7 ,*/

* + Width: 100px! Important;/* supports IE6, 7 ,*/

Width: 100px \ 9;/* supports IE6, 7, 8 */

Width: 100px! Important;/* supports IE6, 7,8, FF */

W \ idth: 100px;/* ie5.x does not support IE6, IE7, IE8, and FF */

------------------
IE condition annotation function:

<! -- [If IE]> This content is only visible to IE <! [Endif]->
<! -[If IE 6.0]> This content is only visible to ie6.0 <! [Endif]->
<! -[If ie 7.0]> This content is only visible to ie7.0 <! [Endif]-> by he min
Source: http://www.hemin.cn
This article is copyrighted. You are welcome to repost this article, but you must keep this statement without the consent of the author. Article The original text connection is clearly displayed on the page. Otherwise, the legal liability is retained.
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.