I want the total height of input field will equal to sum of:
- Top and bottom borders
- Top and bottom paddings
- Line height
The solutions from question How to set the height of an input (text) field in CSS? does not work: the space between top and bottom paddings of input field does not equal to line-height
.
In below example, font-size
and line-height
are 14px
, but contents height is 16px
. Maybe it depends on browser, so I created the screenshot for newest Chrome.
#input {
font-size: 14px;
line-height: 14px;
padding: 10px 12px;
border: 1px solid gray;
margin-left: 12px;
margin-top: 14px;
}
<input type="text" id="input" value="test">