Skip to content Skip to sidebar Skip to footer

Css Reserves An Unknown Space In Box Model

I created a
with some text. I set the width and padding of the
and the font-size of the text inside it. Below is a snippet summarizing the conflict: Accord

Solution 1:

The extra height is caused by the line-height property.

The initial value of line-height is normal.

This, according to the spec, tells browsers to set the value up to 1.2. This gives the text a bit of vertical padding inside the line box.

To resolve the issue, just add line-height: 1 to your code.

Solution 2:

Browsers implement a default line height to text. So in this case there is 1 pixel below and above the text. You can change this by setting line-height: 16px;

Post a Comment for "Css Reserves An Unknown Space In Box Model"