Line-height without units

前端 未结 5 1504
感情败类
感情败类 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:19

    line-height: X; basically translates to line-height: (X*100)%;

    line-height: 1; is the same as line-height: 100%;

    Similarly,

    line-height: 1.5; is the same as line-height: 150%;


    Where line-height: X%; means X% of the line-height of the currently set font and size for the element.

    For example, if the line-height for an element as per the current set font and size is 24px, line-height: 150% would make its line-height 36px. And so on..

提交回复
热议问题