DEV Community

Discussion on: πŸ›‘ Stop using pixels in CSS

Collapse
 
matttunney profile image
Matt Tunney

I mentioned this elsewhere but...

If you reset the HTML font size to 62.5%, you can then declare REM’s in values that seem much more familiar.

 html {
    font-size:  62.5%; /* equal to 10px */
}

body {
    font-size: 1.6rem;  /* equal to 16px */
}

Less mucking about trying to remember any ratios.

In some cases it also makes setting unitless line heights easier to under stand I relation to the declared font-size

 html {
    font-size:  62.5%; /* equal to 10px */
}

body {
    font-size: 1.6rem;  /* equal to 16px */
    line-height: 1.5; /* equal to 24px */
}

Collapse
 
dailydevtips1 profile image
Chris Bongers

That is actually a very nice way to do it!