S
S
Sergey2017-08-31 12:46:39
css
Sergey, 2017-08-31 12:46:39

How to find font height?

Hey!
Example: jsfiddle.net
I have this problem, or I don't understand something.
In the div block I put the text and set the size: and in addition I set the vertical padding: Based on these properties, the height of the block should be 48 + 16 + 16 = 80px. But, in fact, if you look in the devtool, the height of the block is 87px. Where are these 7px coming from? What do I not understand? font-size: 48px;
padding: 16px 0;

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey delphinpro, 2017-08-31
@korenb_white

Unexplored depths of CSS: font metrics, line-hei...

D
display: block, 2017-08-31
@qork

line-height: 48px;

C
cssfish, 2017-08-31
@cssfish

What do I not understand?

you don't understand that the height of the block with text is calculated not from the font size, but from its line-height multiplied by the number of lines. Well, then plus padding, border...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question