The problem only happens on input[type="text"]
in Webkit. No matter what I do, there is the equivalent of an extra padding: 1px 0 0 1px
(top and left only) on the element.
A similar problem happens in Gecko, input[type="text"]
has an equivalent extra padding: 1px 0 0 1px
and input[type="button"]
has an extra padding: 1px 0 0 0
.
Here's a JSFiddle showing you everything I've tried, and nothing works: http://jsfiddle.net/PncMR/10/
Interestingly, when you set the line-height of all the elements to 0
( http://jsfiddle.net/PncMR/11/ ), the only unaffected elements are the ones with the problems, so I'm assuming that the browser is defaulting to a specific line-height, and I'm now looking for a way to override it.
I've found nothing in the webkit base styles that would do this, but feel free to check yourself:
http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css
This is not a moz-focus-inner
problem, or an appearance: none
problem, or a box-sizing
problem, or an outline
problem and I can't find any other solutions.
Edit: See my answer below for the vertical padding problems, but I'm still looking for a solution to the extra padding-left: 1px
equivalent on text-inputs only in webkit and gecko. ( http://jsfiddle.net/PncMR/14/ )
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…