asked 185k views
2 votes
To obtain the desired line height type n, where n is the number that will be multiplied by the element's font sz(just a number with no units)

font-size: .9375em; / 15px/16px/
line-height: n; / 1.65 x 15px=24.75px /

1 Answer

3 votes

to obtain the desired line height type n, where n is the number that will be multiplied by the element's font sz(just a number with no units)

font-size: .9375em; / 15px/16px/

line-height: n; / 1.65 x 15px=24.75px /

To set a line-height that is n times the font-size, you can do:

font-size: .9375em; /* 15px */

line-height: n * 0.9375em;

So for example, for a line-height 1.65 times the font-size:

line-height: 1.65 * 0.9375em; /* 1.65 * 15px = 24.75px */

Or using unitless values:

font-size: 15px;

line-height: n * 15px;

So line-height: 1.65 * 15px; would give 24.75px line-height.

In short, just multiply the font-size unit/value by the n factor you want for the line-height.

answered
User Pavel Teterin
by
8.4k points