如下是经常使用CSS HACK问题及解决代码-DIV+CSS网支持css
1、屏蔽IE浏览器(也就是IE下不显示)html
*:lang(zh) select {font:12px !important;} /*FF的专用*/ |
2、仅IE7识别hack
ide
*+html {…} |
3、IE6及IE6如下识别CSSHACK htm
* html {…} |
4、仅IE6不识别div hackci
select { display /*IE6不识别*/:none;} |
5、仅IE6识别支持it
.yangshi{_height:20px;} |
6、仅IE6与IE5不识别
select/**/ { display /*IE6,IE5不识别*/:none;} |
7、仅IE5不识别
select/*IE5不识别*/ { display:none;} |
8、盒模型解决方法
selct {width:IE5.x宽度; voice-family :"\"}\""; voice-family:inherit; width:正确宽度;} |
9、清除浮动
select:after {content:"."; display:block; height:0; clear:both; visibility:hidden;} |
10、截字省略号
select { -o-text-overflow:ellipsis; text-overflow:ellipsis; white-space:nowrap; overflow:hidden; } |
11、只有Opera识别
@media all and (min-width: 0px){ select {……} } |
以上都是写CSS中的一些HACK,这些都是用来解决局部的兼容性问题,若是但愿把兼容性的内容也分离出来,不妨试一下下面的几种过滤器。这些过滤器有的是写在CSS中经过过滤器导入特别的样式,也有的是写在HTML中的经过条件来连接或是导入须要的补丁样式。
12、IE的if条件Hack
<!--[if IE]> Only IE <![endif]--> |
13、仅IE8兼容识别
div{height:20px\9;} |