Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Joe W
Front End Web Development Techdegree Student 5,623 PointsAdvantages to nesting media queries in sass?
Can someone explain the advantage to nesting media queries like Guil does? Sure, it looks easier for a developer to read, but it seems to be more typing. Also, the output looks far more messy.
2 Answers

Jamie Reardon
Treehouse Project ReviewerHe is showing you how you can nest rules within rules. Why do this? Because you type far less repetition in your code by not having to repeat typing the same class, thus using one rule for the selector.
So it isn't more typing like you said, imagine saving the typing for longer selector names than the example in the video.
The output isn't going to matter, when you are going to compile/code it though sass anyway. Furthermore, you want to limit the level you nest selectors (no more than 2 levels if that).

mdmaleksharafali
2,392 PointsThe correct answer should be: Nesting keeps media queries local to the component and the original styles we are modifying.