【button up】button在firefox 和chrome高度不一致问题解决办法

更新时间:2019-10-23    来源:样式布局    手机版     字体:

【www.bbyears.com--样式布局】


为了验证高度我们将左边放一个高度固定的DIV,你会发现,firefox是要高出2像素的。

HTML为

订阅
样式为
.button {
 background-color:#fff;
 border:1px rgba(0,0,0,0.15) solid;
 color:rgba(0,0,0,0.3);
 padding:6px 8px;
 font-size:12px;
 cursor:pointer;
 line-height:1.6
}

 

我们会发现firefox下和chrome下高度是不一致的,原因是firefox的buttom有一个-moz-focus-inner伪类,我们初始化一下这货就可以了。

/* Remove button padding in FF */

button::-moz-focus-inner {

    border:0;

    padding:0;

}

另外button默认不会响应padding,如需相应则box-sizing设置为content:box

顺便说下firefox chrome中input type=”text” line-height可以决定容器高度,而IE则不会撑起,需要同时写height:

本文来源:http://www.bbyears.com/css/74893.html

热门标签

更多>>

本类排行