Firefox下input button内文字不能垂直居中的解决方法


很老的问题了,如今再次碰到,记录下来,给后来者方便!

众所周知,在Firefox下input type=”button”的文字是不好居中的,原因在于Firefox自己比较二,弄了个私有属性,导致以下问题的出现:

1.按钮左右本身有2px的间距(FF私有属性写了padding:0 2px所致);
2.按钮文字居中是不行的(此时设置padding-bottom是没用的) ;
3.等等…
解决办法:

复制代码
代码如下:

input[type="reset"]::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner{
border:none;padding:0;
}

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3