文档详情

CSS中各个浏览器兼容的解决办法(国外英文资料).doc

发布:2017-06-05约6.68千字共10页下载文档
文本预览下载声明
CSS中各个浏览器兼容的解决办法(国外英文资料) 1. CSS中几种浏览器对不同关键字的支持,可进行浏览器兼容性重复定义 !important 可被FireFox和IE7识别 * 可被IE6、IE7识别 _ 可被IE6识别 *+ 可被IE7识别 区别IE6与FF: background:orange;*background:blue; 区别IE6与IE7: background:green !important;background:blue; 区别IE7与FF: background:orange; *background:green; 区别FF,IE7,IE6: background:orange;*background:green !important;*background:blue; IE7,IE8兼容: meta http-equiv=X-UA-Compatible content=IE=EmulateIE7 / 2. IE专用的条件注释 !--其他浏览器 -- link rel=stylesheet type=text/css href=css.css / !--[if IE 7] !-- 适合于IE7 -- link rel=stylesheet type=text/css href=ie7.css / ![endif]-- !--[if lte IE 6] !-- 适合于IE6及一下 -- link rel=stylesheet type=text/css href=ie.css / ![endif]-- 3. 几个浏览器对实际像素的解释 IE/Opera:对象的实际宽度 = (margin-left) + width + (margin-right) Firefox/Mozilla:对象的实际宽度= (margin-left) + (border-left-width) + (padding- left) + width + (padding-right) + (border-right-width) + (margin-right) 4. 鼠标手势问题:FireFox的cursor属性不支持hand,但是支持pointer,IE两个都支持;所以为了兼容都用pointer 5. FireFox中设置HTML标签的Style属性时,所有位置、宽高和尺寸值必须后跟px,IE也支持此写法,因此统一加px单位。如 Obj.Style.Height = imgObj.Style.Height + ‘px; 6. FireFox无法解析简写的padding属性设置,如padding 5px 4px 3px 1px;必须改为 padding-top:5px; padding-right:4px; padding-bottom:3px; padding-left:1px0; 7. 消除ul、ol等列表的缩进时,样式应写成:list-style:none;margin:0px;padding:0px;其中margin属性对IE有效,padding属性对FireFox有效 8. CSS控制透明:IE:filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=60); FireFox:opacity:0.6; 9. CSS控制圆角:IE:不支持圆角; FireFox: -moz-border-radius:4px;或 -moz-border-radius-topleft:4px; -moz-border-radius-topright:4px; -moz-border-radius-bottomleft:4px; -moz-border-radius- bottomright:4px; 10. CSS双线凹凸边框:IE:border:2px outset; FireFox: -moz-border-top-colors: #d4d0c8 white; -moz-border-left-colors: #d4d0c8 white; -moz-border-right-colors:#404040 #808080; -moz-border-bottom-colors:#404040 #808080; 11. IE支持CSS方法cursor:url()自定义光标样式文件和滚动条颜色风格;FireFox对以上两者均不支持 12. IE有Select控件永远处于最上层的bug,且所有CSS对Select控件都不起作用 13. IE支持Form中的Label标签,包括图片和文字内
显示全部
相似文档