CSS 兼容性解决方案

1、Div的垂直居中的问题

vertical-align:middle; 将行距增加到和整个DIV一样高 line-height:200px; 然后插入文字,就垂直居中了。缺点是要控制内容不要换行

2、IE6下图片有空隙产生

解决这个BUG的方法也有很多,可以是改变html的排版,或者设置img display:block 或者设置vertical-align 属性为vertical-align:top   bottom  middle  text-bottom 都可以解决.

3、IE6、IE7、Firefox之间 的兼容写法

    1):

IE都能识别*;标准浏览器(Firefox)不能识别*

IE6能识别*,但不能识别 !important,

IE7能识别*,也能识别!important;

Firefox不能识别*,但能识别!important;

根据上述表达,同一类/ID下的CSS hack可写为:

.searchInput {

background-color:#333;/*三者皆可*/

*background-color:#666 !important; /*IE7*/

*background-color:#999; /*IE6IE6以下*/

}

2):

IE6可识别“_”,而IE7Firefox皆不能识别,所以当只针对IE6IE7Firefox之间的区别时,可这样书写:

.searchInput {

background-color:#444;/*通用*/

_background-color:#555;/*IE6可识别*/

}

3):

*+html *htmlIE特有的标签, Firefox 暂不支持。

.searchInput {background-color:#333;}

*html .searchInput {background-color:#666;}/*IE6*/

*+html .searchInput {background-color:#555;}/*IE7*/



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值