关于css中 line-height 在ie中和在chrome中错位的问题

来源:互联网 发布:navicat写sql语句 编辑:程序博客网 时间:2024/06/05 03:03

 一 丶

IE9不支持line-height原因:中文ie9不支持英文字体

相信大家在IE9看见自己使用line-height设置垂直居中文字不能垂直居中,这是与你设置字体有关,通常大家习惯设置font-family:Arial, Helvetica, sans-serif;

ie9中line-height失效解决方法:
只需设置好字体,添加个宋体即可解决 如CSS代码font-family:Arial, "宋体",Helvetica, sans-serif;

设置字体时候注意,还需设置大家都默认系统自带字体,如黑体,宋体。


二丶

样式表中可以写line-height:28.5px !important;line-height:48.5px;(padding=10px)


因为ie中会忽视 “!important”这个属性 这样就会读取48.5的line-height 而火狐和chrome不会忽视这个属性 就会读取line-height=28.5

1 0
原创粉丝点击