I’ve been transferring over CSS to SCSS, and while doing so, I’ve encountered something I find quite odd. I’ve noticed that SCSS isn’t so accepting of ems in media queries, and I’m not sure why.
Give us your broken browser-outputted CSS (remember, SCSS just converts the SCSS to regular CSS that isn’t an abomination.)
It’ll be easier to debug if we can see what the browser is rendering; the browser will muddle through the crap that is SCSS and show us the goodies/output (CSS).
Is there a website you can link us where it shows hte issue? The query is valid so perhaps it’s not targeting the screen sizes you want and there’s a misunderstanding there.
This isn’t related to your problem but I highly recommend using breakpoint. One of the best features is breakpoints can be nested in other rules which results in more clear, readable code. Not to mention there is a means of isolating styles to support browsers that lack media query support. If you want to take it further I recommend checking out susy which is a grid library for sass that integrates directly with breakpoint.
Thanks @oddz, I will definitely look into susy for my upcoming project. I was reading that it said Susy is built to coincide with Compass. Do you know if it’s a must to use Compass with Susy?
@RyanReese, I found my problem, I was missing a bracket! off all the things I missed… a bracket! Apparently all I needed was break from staring at code. Thanks though!
Must have been in a code block you didn’t post because I didn’t see any missing bracket, and the outputted CSS from your example validated . Glad you figured it out.
and back to square one… I can’t seem to figure out what I’m missing as to why ems are not working.
Here is a link to my navigation. It seems to break on the smallest screen and the sm-tablet screen, and I just can’t see where. This is making me insane!
normally I’ve never set a min-width for small screens. I usually start at landscape size so 400px and up generally. Would that make a difference with SCSS?
Needs to just be made into max-width…I dunno how you plan on overriding smaller styles or whatnot…or roll the styles onto larger screens and let the larger styles override the smaller. Depends on what you plan to do.
You seem to have a lot of breakpoints…more than probably is necessary.
I work from mobile first, if that helps. My problem is not the number of queries, some of those queries serve other purposes, not necessarily intended for the navigation. Even if I don’t give my smallest area (mobile) a defined query, which immediately fixes my problem, it still causes issues in my small tablet query. I’m not sure why but it doesn’t like seem to like ems, but it responds nicely to pixels. This is what I’m not comprehending.
Your website is referencing “(min-width: 21.429em)” which seems to have fixed that issue. Though with font-size:100% it will base it off the user font size so it could very well again break if users have larger font sizes set.
I just find it weird that it works in pixels and not in ems. I’m going to try and see if reset my font size to standard browser size and see if that works better.