3 ms·
Multiple files Considering everything is global in CSS, the importing order isn't important. It only is when using Sass where you have variables and mixins tha
by bbx 11y ago
Multiple files
Considering everything is global in CSS, the importing order isn't important. It only is when using Sass where you have variables and mixins that must be defined before using them. And with Sass, it's very easy to setup separate files that you import all at once in a single file. Structure example: http://tech.streethub.com/styleguide/css/app.html http://tech.streethub.com/styleguide/css/app.html
Nesting
One of the biggest issue you encounter when writing CSS is _specificity_. Not only does nesting allow to match your Sass hierarchy with the HTML one, but it also naturally creates more specific selectors that saves you from keeping mind which rules are going to be applied.
Pixel units
Oh yes, using "em" is very elegant... but a pain in the long run. Font sizes need precise pixels to render correctly. Images need pixels for alignment. Borders need to be defined in pixels or end up disappearing. And you'll avoid crazy calculations with 4 decimals. I actually just wrote an article about it: http://jgthms.com/in-css-use-pixels-not-em.html http://jgthms.com/in-css-use-pixels-not-em.html
Device breakpoints
Breakpoints aren't meant for _devices_ but for your _element's_ size. It doesn't matter how your layout will end up looking on a 320px-wide screen. What matters is how your element will look like until 500px, and beyond that. With Sass I have 2 responsive mixins: +from($breakpoint) and +until($breakpoint). That's all you need.
- zaphar 11y agoThis is actually not strictly true and can trip you up if you aren't careful. Two rules with the same specificity depend use last one wins. In that case import order matters.