Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJean-Luc Robitaille
13,864 PointsRem units not affected by <html> font size.
Hello everyone!
I am working on a small personal project, just to practice CSS Grid layout. Now I am simply trying to set my rem units so that 1rem = 10px. And then set a media query to change at 400px using rem units (so 40rem).
My CSS file is setup like this:
html{
font-size: 62.5%; /* I also tried with font-size: 10px; */
}
@media screen and (min-width: 40rem){
}
My thinking was that the default html font-size was 16px. So 62.5% of 16px would give me an html font size of 10px. Then my query would switch at a screen size of 400px (40 x 10px).
But when I test it in either Chrome or Firefox, the media query changes the layout at 640px. So it looks like the root font-size is still 16px??
I don't understand why I'm not able to change the value of my rem units by changing the html font size.
Anyone has a clue?
Thanks!
Jean-Luc
Kieran Barker
15,028 PointsKieran Barker
15,028 PointsThis is really pissing me off! I can't figure it out either!