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 trial

WordPress

Wart Burggraaf
Wart Burggraaf
9,948 Points

Need help using SCSS Variables with Foundation

Hi,

I am working with the Foundation framework. Using variables is easy at first. I put them on top of the SCSS document before the @import "foundation";

But further down the document I like to use @media queries. If I use SCSS variables there nothing happens.

Could you help me out?

Thanks in advance.

By the way, this is what I mean:

$topbar-height: 35px; //works
@import "foundation";
@media #{$small} {
$topbar-height: 45px; //doesn't work
}

2 Answers

Just looking at your code, could it be that you haven't told @media #{$small} any scss to parse? Would the right syntax if you want to set the height be:

$topbar-height: 45px; 
 @import "foundation";
@media #{$small} {
 height: $topbar-height; 
}

Currently you have just the value of what $topbar-height but haven't called it

Wart Burggraaf
Wart Burggraaf
9,948 Points

Thank you for your reply. Yet it doesn't answer the question.

Maybe my question needs more explanation:

I work with the Foundation framework together with Compass and SCSS. With the variable $topbar-height I can specifically change the height of the topbar (menu on top). It works perfectly. But, because of the responsive layout, I would like to give the topbar a different height at certain breakpoints. I do not understand how to change its value at those breakpoints.

I hope my explanation makes my question more clear. Thanks a lot.