Line-height without units

前端 未结 5 1511
感情败类
感情败类 2020-12-09 10:30

I saw people using line height without specifying a unit, like this: line-height: 1.5;

What does the number represents? I\'m guessing it\'s a ratio so i

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 11:24

    line-height@ Mozilla Developer Network has a very good explanation (and examples) which is a easier to understand compared to the line-heightCSS specification.

    line-height can have the value specified in one of the following ways

    line-height: normal |  |  | 
    

    In your case, you are using a which is described as:

    The used value is this unitless multiplied by the element's font size. The computed value is the same as the specified . In most cases this is the preferred way to set line-height with no unexpected results in case of inheritance.

提交回复
热议问题