CSS Hack代码与浏览兼容总结
来源:互联网 发布:管理权限的软件 编辑:程序博客网 时间:2024/06/05 07:11
1, IE条件注释法,微软官方推荐的hack方式。
只在IE下生效<!--[if IE]>这段文字只在IE浏览器上显示<![endif]-->只在IE6下生效<!--[if IE 6]>这段文字只在IE6浏览器上显示<![endif]-->只在IE6以上版本生效<!--[if gt IE 6]>这段文字只在IE6以上版本IE浏览器上显示<![endif]-->只在IE7上不生效<!--[if ! IE 7]>这段文字在非IE7浏览器上显示<![endif]-->非IE浏览器生效<!--[if !IE]><!-->这段文字只在非IE浏览器上显示<!--<![endif]-->
2.综合一下常用的CSS Hack代码
.csshack{ background:blue; background:blue\9; /*all ie*/ background:blue\0/; /*ie8-ie9*/ background/*\**/: blue\9; /* ie7-ie8*/ *background:blue;/* or #background: blue */ /*ie6-ie7*/ +background:blue; /*ie7*/ _background:blue; /*ie6*/}:root .csshack{ background:blue; /*大于等于ie9*/}/* IE9, IE10 */@media screen and (min-width:0\0) { .csshack { color: red}}/* IE 10+ */@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { #veintiun { color: red; }}/* saf3+, chrome1+ */@media screen and (-webkit-min-device-pixel-ratio:0) { #diez { color: red }}/* iPhone / mobile webkit */@media screen and (max-device-width: 480px) { #veintiseis { color: red }}/* Firefox only. 1+ */#veinticuatro, x:-moz-any-link { color: red }/* Firefox 3.0+ */#veinticinco, x:-moz-any-link, x:default { color: red }/* FF 3.5+ */body:not(:-moz-handler-blocked) #cuarenta { color: red; }
3.IE CSS Media,来自这里 3.IE CSS Media,来自这里
/* @media hacks *//* IE6/7 only (via Keith Clarke) */@media screen\9 { }/* IE6/7/8 (via Keith Clarke) */@media \0screen\,screen\9 {}/* IE8 (via Keith Clarke) */@media \0screen { }/* IE8/9/10 */@media screen\0 { }/* IE9/10 */@media screen and (min-width:0\0) { body { background: yellow; }}
4.button重置css样式兼容ie6,ie7
button在IE6、IE7下的兼容性,需要充值css为overflow:visible
5.让IE6支持max-width,min-width
.sector{max-width:500px; _width:expression((documentElement.clientWidth>500)?"500px":"auto");min-width:300px; _width:expression((documentElement.clientWidth<300)?"300px":"auto");}
6.IE6下某些情况line-height无效
当在一个容器里文字和img、input、textarea、select、object等元素相连的时候,对这个容器设置的line-height数值会失效; 同时以上元素的行高可能×2。
受影响的浏览器: Microsoft Internet Explorer 5.01 / Windows Microsoft Internet Explorer 5.5 / Windows Microsoft Internet Explorer 6
解决办法:
对和文字相连接的img、input、textarea、select、object等元素加以属性:
{margin: (所属line-height-自身img,input,select,object高度)/2px 0;vertical-align:middle;}
0 0
- CSS Hack代码与浏览兼容总结
- IE6、IE7、Firefox兼容CSS Hack总结
- 兼容ie 火狐 谷歌等各大浏览器css hack代码总结
- CSS Hack汇总快查(CSS兼容代码演示)
- CSS Hack汇总快查(CSS兼容代码演示)
- CSS Hack汇总快查(CSS兼容代码演示)
- 浏览器兼容 CSS hack
- CSS HACK 全面兼容
- 兼容全部浏览器的CSS HACK收集与整理
- CSS hack与各个浏览器兼容、JS等
- CSS之hack与浏览器兼容常用技巧
- 兼容ffIE678 hack(IE6、IE7、IE8、Firefox兼容性CSS HACK代码+示例)
- CSS hack浏览器兼容一览表
- CSS hack浏览器兼容一览表
- CSS hack浏览器兼容一览表
- CSS hack浏览器兼容一览表
- CSS hack浏览器兼容一览表
- CSS hack浏览器兼容一览表
- Fragment 嵌套-> ViewPage 嵌套->Fragment 不显示
- (2,1,2)卷积码的维特比译码Verilog实现
- nyoj--586--疯牛(二分&&枚举)
- 省市区解析
- 【uml】-九种图之活动图(Activity Diagram))
- CSS Hack代码与浏览兼容总结
- 用Python读取大文件(上)
- linux64 rh7 下安装oracle11g(r2)
- 自学Python第一周——print的用法总结
- 隐语义模型LFM
- [kuangbin带你飞]专题一 简单搜索 B - Dungeon Master poj2251
- 回调函数
- C/C++ debug(一)
- java 注解