- This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
Viewing 9 posts - 1 through 9 (of 9 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hey guys ! I’m not sure that i understand why its recommand to use EM more than PX in responsive web design. Can you guys explain me the reason why everybody use EM? thanks !
This subject has been covered: https://css-tricks.com/forums/discussion/15558/which-font-sizing-is-best-em-vs-px-vs-#Item_42
Please don’t start it all up again.
I think it’s a fun discussion to ‘start it all up again’ because of what I read here: [Beginner’s Course on HTML CSS by Shay Howe](http://learn.shayhowe.com/html-css/typography “Beginner’s Course on HTML CSS by Shay Howe”)
Scroll to the portion on text sizes. That course’s advanced course was suggested by Chris so I assume the Basic one holds water too.
Just to add a little extra to this, I use REM’s instead of EM’s as the math gets complex using EM’s.
REM’s base themselves on the HTML font-size. So nested font-sizes don’t get exponentially bigger/smaller/more complex.
If you use SASS/SCSS – don’t go alone, take this Mixin;
@mixin font-size($sizeValue){
font-size: $sizeValue + px;
font-size: ($sizeValue / 10) + rem;
}
// To use it;
html { font-size: 10px; } // or whatever size you want
.element { @include font-size(14); }
//This outputs;
.element {
font-size: 14px;
font-size: 1.4rem;
}
> REM’s base themselves on the HTML font-size. So nested font-sizes don’t get exponentially bigger/smaller/more complex.
Thank you! I thought it was my imagination the first time I saw that happening. I hate using EMs just for that reason.
> joshuanhibbert
Yes, I will read everything on that link.
@Dami – Only thing to watch out for with REM’s is that IE8 and below don’t support them, so make sure to use a PX fallback, placed before the REM in the code, just in case.
Ditto for vw, vh and vmin