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

How to use hack of css

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

Share

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

Most people do not understand the knowledge points of this article "how to use css's hack", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use css hack" article.

First of all, we need to know what HACK is. To put it simply, it is a piece of code that can only be used in a specific browser; generally speaking, there are three forms:

1. Attribute prefix method (internal Hack of css class)

When we use different codes in different browsers, for example, we can recognize the symbols "_" and "*" in IE6, intelligently recognize the symbol "*" in IE7, and recognize the symbol "\ 9" in IE6-IE10, but we can't operate the three symbols we mentioned in firefox. (related code examples can be seen in the css hack collection)

two。 Selector prefix method (selector Hack)

The syntax for this method looks like this: select {sRules}.

The code example code in IE6 is as follows:

* html .test21 {color: gold;}

The code example code in IE7 is as follows:

* + html .test22 {color: blue;}

The example code that takes effect in IE6 or IE7 is as follows:

@ media screen\ 9 {

.test23 {color: purple;}

}

The example codes that take effect in IE6, IE7 and IE8 are as follows:

@ media\ 0screen\, screen\ 9 {

.test24 {color: gold;}

}

The example code that takes effect in IE8 is as follows:

@ media\ 0screen {.test25 {color: orange;}}

The example codes that take effect in IE8, IE9, IE10 and IE11 are as follows:

@ media screen\ 0 {.test26 {color: green;}}

The example codes that take effect in IE9, IE10 and IE11 are as follows:

@ media screen and (min-width: 0\ 0) {.test27 {color: red;}}

3.IE conditional annotation (Html header refers to Hack)

This method is special for all IE (no longer supported above IE10) in Html header references. Similar program statements can only be used in HTML files, not in css files, and can only be used in IE browsers. In other browsers, they will be used as comments and do not execute the code as follows:

The above is about the content of this article "how to use the hack of css". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

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