← Back to Upcase

Can't set background for body element

(Acandael Acandael) #1


In my Neat Bourbon website, I want to set the background for the body element:

body {
background-color: lighten($brokenwhite, 5);

However, when I check in the browser (with Chrome DevTools), the background style for the body element still is:

background: white;

I can’t seem to find which style is overriding the background color for the body element.

my source code is at: https://github.com/acandael/colloquium

thanks for your help,


(Luís Ferreira) #2

Check for any background rule that’s defined after yours or is more specific. That’s probably a CSS precedence problem.

Also, in the chrome inspector, you can see in which file and/or line the rule is defined.

(Derek Prior) #3

You have $brokenwhite defined as #f8f9fc. This color cannot be lightened 5%. It just results in white. Nothing is overriding your CSS, it’s just that lightening is resulting in white.

(Acandael Acandael) #4

hi derekprior, I turned of the lightening and just defined

background: $brokenwhite;

but the background of the body element is still white. The odd thing is that I defined also brokenwhite for the section element of the index page, and there the background is brokenwhite

thanks for your help,


(Acandael Acandael) #5

hi zamith, I tried to see which style definition is overwriting the background color, but in Chrome devtools I only see the mapping to .css files, not to .scss files.



(Acandael Acandael) #6

my bad, forgot to turn on sass

sass --watch .

the background color of the body element now is brokenwhite



(Luís Ferreira) #7

@acandael_acanda Glad that you got it working.

Your SASS files have to be compiled to CSS in order for the browser to understand them, so that’s what Chrome dev tools will point to. Not sure if there’s a plugin to chrome to link to SASS files, but it is usually easy to understand the mapping between CSS and SASS.