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.

CSS Sass Basics Add Reusable Logic to Your Sass Storing Values in Maps

Sass Maps

So, I'm having trouble understanding this.

So, if it's less than 'sm' $break it'll apply the 'xs' breakpoint.

But it's it's greater than 'sm' will it just apply the 'med' or will it instinctively know to apply the 'lg' $break. Or would I have to apply that logic to the mixin?

1 Answer

You're still passing the $break to the mixin from the previous videos, so the function is aware of whether this is applying to a xs, sm, med, or lg screen. In this lesson, the variables at the top are using that value to pull back a number from the map. Once the number values are returned, the if-statement is then checking whether the statement is less than the value returned by 'sm'.

essentially in pseudo-code: if the value returned is less than small return the media query with max-width of the value else (you don't have to write this in the code, but if all other situations: greater than or equal to small) return the media query with min-width of the value