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 trialVincent Bellittera
20,411 PointsMy $primary-color variable will not work on my styles.scss page!!! HELP ME!!!
I am in Sass Basics, and I was just introduced to variables. I have my .scss and .css page opened in Sublime, Git Bash is open and WATCHING for changes. Everything is working great, but now I added $primary-color: #333, and added that to my body rule and it will not work. PLEASE HELP ME.
5 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Vincent,
It should be at the top of the file and not inside your body
rule if that's what you did.
In order for anything to be that color though you have to set a properties value to that variable.
Examples: background: $primary-color
or color: $primary-color
Those example declarations would be inside one of your css rules.
Vincent Bellittera
20,411 PointsHow funny!!! Thanks so much... It was driving me crazy!!
Stephen Goeddel
11,239 Pointsdid you end that with a semi-colon? ex.
$primary-color:#333;
please show me your CSS rule as well.
Vincent Bellittera
20,411 PointsHey Guys, I had another quick question. I am using Sublime Text 2, and when I am working on a .scss file I am not getting the color coded prediction as I write the code. Everything works fine in .html and .css files. In the tutorial with Hampton, his .scss file is color coded just like all the other files. Am I doing something wrong?
Stephen Goeddel
11,239 Pointsquick search leads to this plugin: https://sublime.wbond.net/packages/SCSS
Vincent Bellittera
20,411 PointsThanks Stephen. I just installed Emmet earlier today. I didn't even think to look in there for a fix for this problem... Thanks so much, I really appreciate the help!
Vincent Bellittera
20,411 PointsVincent Bellittera
20,411 PointsHere is what I have.
/* scss document */
$primary-color: #333;
body { background: primary-color; font-family: Futura, "Trebuchet MS", sans-serif; > h1 { font-size: 3em; color: #eee; margin: 5px 0 0 5px; } }
.entry { background: white; margin: 5px; padding: 5px; h1 { font-size: 1.2em; margin: 0px; } .date { font-size: 0.3em; color: #333; } a { color: #333; } }
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsYou left off the
$
when using the variable for thebody
background color.