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 way to write hack compatible with different browsers in CSS

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

Share

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

This article mainly introduces the CSS hack compatible with different browsers of what is written, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

IE6 has more users than the old version of the predator.

IE7 is newer and closer to the standard browser.

IE8 is a Microsoft standard browser, but it is different from the reader.

Firefox (Mozilla, Firefox) and google Reader (chrome) are relatively standard IE browsers. As usual, we use this hunter as a repulsive reference platform. At the same time, IE8 and these two readers show that CSS is on the verge of comparison. We usually only need to test the compatibility of Firefox and google browsers to determine IE8.

So in general, the way we distinguish between these browsers CSS hack becomes simple, we only need to think about IE6\ IE7\ Firefox (Firefox) these three readers can be compatible with all browsers.

The specific differences are as follows:

Distinguish IE6 from FF:

Background:orange;*background:blue

Distinguish IE6 from IE7:

Background:green! important;background:blue

Distinguish IE7 from FF:

Background:orange; * background:green

Distinguish between FF,IE7,IE6:

Background:orange;*background:green! important;*background:blue

Note: IE can recognize *; scale wading devices (such as FF) can not recognize *

IE6 can recognize *, but not! important

IE7 can recognize *, can also recognize! important

FF can't recognize *, but it can! the following is the CSS hack table for each reader: important;

IE6

IE7

FF

*

×

! important

×

Add the rest, underscore "_"

IE6 is in favor of underlining, IE7 and firefox are not in favor of underlining.

So how else might everyone judge IE6,IE7,firefox: background:orange;*background:green;_background:blue

Note: no matter what the method, copying is usually written at the front of firefox, at both ends of IE7 and at the front of IE6.

The above is the way to distinguish the CSS hack of each reader. Above, we can easily introduce these CSS hack uses:

Requirements: suppose we set a class CSS property named exple, the CSS color frame is 1PX black border, the height is 100PX, and the requirement is 150PX under the width of 100PX in IE7 browser; 200PX in Firefox IE8google; (PX is a unit of length pixel)

The CSS code is as follows:

.exple {border:1px solid # 000; height:100px;width:200px; * width:150px! important; * width200px;}

How only need to configure a div class in html (class= "exple"), how this part in Firefox, IE8, google hunting device will reflect the width of 200px height of 100px with 1px black border box; IE7 reader width of 150PX height of 100px with 1px black border box; in IE6 browser will show the length and width of 100px with 1px black edge of the square.

Thank you for reading this article carefully. I hope the article "how to write hack compatible with different browsers in CSS" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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