Px to Em and line height question
-
I am posting this in hopes someone else can find good use of it as I did. It’s a handy-dandy conversion chart to convert px to Em
https://pxtoem.com/Can anyone explain the relationship with between the line height and your px and em setting, And why it is important?
Example taken from the twenty twelve theme as examples can teach faster than anything.
$rembase: 14; $line-height: 24; ---------- Examples * Use a pixel value with a rem fallback for font-size, padding, margins, etc. padding: 5px 0; padding: 0.357142857rem 0; (5 / $rembase) * Set a font-size and then set a line-height based on the font-size font-size: 16px font-size: 1.142857143rem; (16 / $rembase) line-height: 1.5; ($line-height / 16)
Ok so I’m going to switch my font-size to 18px. So I go to the chart and it tells me on a rembase of 14 my rem should be 1.286em so I would plug in this
font-size: 18px font-size: 1.286rem; (16 / $rembase) line-height: 1.5; ($line-height / 16)
So the question now is what do I do with the (16 / $rembase)? Do I make it (18 / $rembase)?
And how do I convert the line-height?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Px to Em and line height question’ is closed to new replies.