0

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.

enter image description here

#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">
Takeshi Tokugawa YD
  • 670
  • 5
  • 40
  • 124

1 Answers1

0

#input {
 font-size: 14px;
 line-height: 14px;
 border: 1px solid gray;
  
 margin-left: 12px;
 margin-top: 14px;
}
<input type="text" id="input" value="test">
Shanmugapriya D
  • 306
  • 3
  • 13