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

CSS

Daniel Oropeza
Daniel Oropeza
4,432 Points

What does the "$" mean in character in scss and sass?

So I was taking a look at css and scss files for the bones wordpress theme. And I see that the author put a "$" before the value for each color attribute. For example, this is some of the code in a scss file.

/*********************
HEADER STYLES
*********************/

.header {
    background-color: $black;
}

    #logo {
        margin: 0.75em 0;

        a {
            color: $blue;
        }
    }

Thanks in advance.

EDIT: Press edit on your post and look how i formed you code so it displays properly.

3 Answers

Kevin Korte
Kevin Korte
28,149 Points

It's a variable. So somewhere in a Sass file, before the compiler gets that that line of code, you would fine a definition like this

//Sass variables
$blue: #0000ff;

So when the compiler, compiles, the resulting CSS file will have #0000ff. If I use the blue variable multiple times, and later decide I want to change the shade of blue, I only have to change it one place, and than recompile.

jason chan
jason chan
31,009 Points

$variable similar to php.