Some math

Hi guys,

I need you to do me a math, I think it’s easy and tricky at the same time.

I have a pair value of font size and line height, 13px-20px, where 13px is font size and 20px is line height.

Condition, if font-size increases by 1, line-height will increase by 2. So 14px font-size will result 22px line height.

Now, if given a font-size value, can you figure out the line height?

It always works.

The lineheight starts at 20, and for every fontsize > 13, 2 will be added, so we get:

lineheight = 20 + (fontsize-13) * 2

which is equivalent to:

lineheight = 20 + 2*fontsize - 26

and that is equal to:

lineheight = 2*fontsize - 6


Congrat Webmachine and ScallioXTX, with very concise explanation. Thanks Guys!

If the font is 13px, the line height must be 20px.
If the font is 14px, the line height must be 22px.
If the font is 15px, the line height must be 24px.

So I give you font of 200px can you get the line height?

Try doubling the font size and subtracting 6. This works with the three examples you showed.

is 13 the base font size ALWAYS?

ok i haven’t done this in years, this sounds like homework… I almost have it