input, select { padding: 2px; border: solid 1px red; }
<input value="Foo">
<select><option>bar!</option></select>
Even though these both have the same padding
and border-width
, the resulting <select>
is clearly taller than its corresponding <input>
. (tested in Firefox)
Can you explain the reasoning behind the height difference? If I remove padding
or border-width
rules then the problem goes away. Unfortunately that's not a good solution for my project.
I am hoping to have pixel-perfect layouts that are cross-browser consistent, even with mobile browsers. Thus far, I've always been maintaining a different padding
for <select>
than I have for <input>
, but would prefer if I could use one setting for both.
We found a simple CSS rule to solve a similar question in regarding <button>
s in Firefox. I know it may not be so simple for <select>
I posted this question to find out for sure.