How does line-height vertically center text?

前端 未结 5 493
别跟我提以往
别跟我提以往 2021-02-07 07:51

I\'m trying to understand why the line-height CSS property places the text vertically in the middle of this button:

5条回答
  •  执念已碎
    2021-02-07 08:30

    it is by design. If the CSS parser (i.e. the browser) doesn't know how tall is your text, he can't vertical align your text correctly.

    Note there is a default value of line-height property.

提交回复
热议问题