Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of formal CSS hack technology in IE8 browsers

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

IE8 browser in the formal version of CSS hack technology usage, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

To describe the use of IE8 CSS hack technology, the official version of IE8 has been out for some time, but there are very few CSS hack for the official version of IE8, which is lucky because IE8 fixes a lot of BUG of IE6 and IE7, which is closer to the W3C standard.

IE8 CSS hack technology

There are two types of CSS hack available for the official version of IE8:

* species: "\ 9":

The basic way to write:

1..test {color/*\ * * /: blue\ 9}

This IE6, IE7, and IE8 can all be recognized; but IE8 does not recognize the csshack; of "*" and "_", so we can write hack like this:

1..header {width:300px;} / * all browsers * / 2..header {width/*\ * * /: 330px\ 9;} / * all browsers IE browsers * / 3..header {* width:310px;} / * IE7 and IE6 can recognize, IE8 and FF can't recognize * / 4..header {_ width:290px;} / * IE6 can recognize, IE7, IE8 and FF can't recognize * /

The second is to use the conditional comments of IE

Conditional comments are a unique feature of IE that allows separate XHTML code processing for IE series products, note that it is mainly for XHTML, not CSS.

Conditional comments are very powerful and can be used for true and false judgments, such as:

Program code

This content is visible only to IE. This content is visible only to IE6.0.

Conditional comments can be determined by IE as to what version of the browser it is, and display the contents if the conditions are met. The annotation function is supported from IE5.0 to 7.0, and the version number is accurate to 4 decimal places:

Program code

This content is visible only to IE6.1

IE conditional comments also support exclamation point non-operations:

Program code

This content is visible except for the IE6.0 version

Prefixes are also supported to determine whether a higher version or a lower version:

Program code

This content can only be seen in IE5.0 and above

The full name of gt here is greaterthan, which means that the current conditional version is above, but does not include the current version.

There are several other prefixes:

Lt represents a version below the current conditional version of lessthan and does not include the current version.

Gte represents the current version of greeterthanorequal and includes the current version.

Lte represents the current version of lessthanorequal below and includes the current version.

Some other csshack tests:

1..color1 {color:#F00;color/*\ * * /: # 00F color:#F00;color/* * /} / * IE6,IE7,IE8,FF,OP,SA recognition * / 2..color2 {color:#F00;color/*\ * * /: # 00F IE7,IE8,FF,OP,SA recognition * / 3..color3 {color:#F00 Color/*\ * /: # 00F\ 9} / * IE6,IE7,IE8 Identification * / 4..color4 {color:#F00;color/*\ * /: # 00F\ 9} / * IE7,IE8 Identification * / * there is a space * / between "color" and "/ *\ * * /".

Where OP means Opera,SA and Safari

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report