A CSS filter is a way of displaying or hiding rules or declarations from a particular browser or group of browsers. Filters rely on weaknesses in a browser such as parsing bugs and unimplemented or incorrectly implemented CSS to show or hide rules from that browser.
CSS 过滤器(filter )是•一种对特定的浏览器或浏览器组显示或隐藏规则或声明的方法。过滤器根据浏览器中的缺陷,比如解析bug 以及未实现或错误地实现的CSs ,对浏览器显示或隐藏规则。
A CSS hack is simply an ugly and inelegant way of getting a browser to behave the way you want it to. CSS hacks are typically used to get around specific browser bugs such as IE’s proprietary box model. Unfortunately, the term hack has rather negative connotations and implies that there is a better way of doing something when often there isn’t. Therefore,some people favor the term patch to indicate that it is actually incorrect browser behavior that is being dealt with.
CSS 招数是一种让浏览器表现得符合自己希望的不优雅的方法。CSS 招数通常用来解决特定的浏览器bug ,比如IE 的专有框模型。不幸的是,招数(hack )这个词有比较强的负面意义,而且它暗示着还有更好的方法,尽管常常没有。因此,有些人喜欢用补丁(Patch )这个词表示它实际上利用了不正确的浏览器行为。
CSS hacks can use filters to apply one rule to one browser and a different rule to another. Alternatively, hacks can use incorrect CSS implementation to “trick” browsers into behaving the way you want them to. In essence, a CSS filter is a specific type of hack used for filtering different browsers. Unfortunately, most people tend to use the generic term hack to describe filters. As such, when people talk about CSS hacks, they are usually talking specifically about filters.
CSS 招数可以使用过滤器将一个规则应用于• 种浏览器,将另一个规则应用于另一种浏览器。招数也可以利用不正确的CSS 实现,从而“哄骗”浏览器表现得符合自己的希望。从本质上说,CSS 过滤器是一种用来过滤不同浏览器的招数类型.不幸的是,大多数人一般使用通用词招数来描述过滤器。因此,当人们谈到CSS 招数时,他们往往是特指过滤器。
关于招数和过滤器的一个警告
As a language, CSS was designed to be very forward compatible. If a browser doesn’t understand a particular selector, it will ignore the whole rule. Likewise, if it doesn’t understand a particular property or value, it will ignore the whole declaration. This feature means that the addition of new selectors, properties, and values should have no adverse effect on older browsers.
作为一种语言,CSS 设计成具有很强的向前兼容性。如果浏览器不理解某个选择器,那么它会忽略整个规则。同样,如果它不理解某个属性或值,它就会忽略整个声明。这个特性意味着添加新的选择器、属性和值应该不会对老式浏览器产生严重的影响。
You can use this feature to supply rules and declarations to more advanced browsers, safe in the knowledge that older browsers will degrade gracefully. When a new version of the browser is launched, if it now supports the CSS you were using as a filter, it should work as expected. If you are using the more advanced CSS to circumvent a problem in the older browsers, hopefully this problem will have been solved in the newer version. Because of this behavior, the use of unsupported CSS as a filtering mechanism is a relatively safe option. I say relatively because there is always a chance that the browser will support your new CSS but still exhibit the bug you were trying to fix.
可以利用这个特性,对比较高级的浏览器应用规则和声明,同时可以确定老式浏览器会平稳地退化。当浏览器的新版本发布时,如果它现在支持你作为过滤器使用的CSS ,那么它应该会如预期那样工作。因为浏览器会越来越符合标准,如果使用比较高级的CSS 克服老式浏览器中的问题,这个问题很有希望在新版本中得到解决。因此,使用不支持的CSS 作为过滤机制是一种相对安全的方法。之所以说“相对”是因为浏览器有可能支持新的CSS ,但是仍然表现出你试图修复的bug 。
Using filters that rely on parsing bugs is a slightly more dangerous route. This is because you are relying on a bug, not a feature. Similar to the previous method, if the parsing bug gets fixed but the bug you are trying to fix hasn’t been addressed, you could end up with problems. However, more of a concern is that parsing bugs could find their way into newer versions of browsers. Say, for instance, a new version of Firefox has a particular parsing bug. If that bug is being used as a filter to supply IE with different width values to account for its proprietary box model, all of a sudden Firefox would inherit that width, potentially breaking a lot of sites.

RSS订阅![几个div css布局超炫的特效演示[漂亮]](http://www.isstudy.com/uploads/allimg/100608/1_060QJPV227.jpg)






