iPhone< button>填充不变?
问题描述:
Mobile Safari中的HTML5 < button>
似乎具有固定的,不可更改的左右填充。 这里是演示,以及它在Safari 5和iOS4中的外观。
A HTML5 <button>
in Mobile Safari seems to have fixed, unchangeable left and right padding. Here's a demo plus how it looks in Safari 5 and iOS4.
如何摆脱这个填充?
答
只是想出了附加填充总是1em。如果你使用绝对数字的字体大小,你可以将按钮的字体大小设置为0,并重置它的内部元素:
I just figured out that the "additional padding" is always 1em. In case you use an absolute number for your font-size, you can set the button's font-size to 0 and reset it for the inner element:
button{
font-size:0;
}
button span{
font-size:14px;
}
<button><span>Submit</span></button>