Guys my CSS background color is not working .. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Guys my CSS background color is not working ..

i even copy paste it so it is assured but nothing it is not working pls help

25th Feb 2018, 11:26 AM
Christian Jay Medallo
Christian Jay Medallo - avatar
28 Answers
+ 3
could you show the code? maybe I could help then.
25th Feb 2018, 12:21 PM
xdeathbossx
+ 2
cause then I could find your mistake
25th Feb 2018, 12:22 PM
xdeathbossx
+ 2
Show us the code so that we may debug it.
25th Feb 2018, 12:28 PM
Naveen Maurya
Naveen Maurya - avatar
+ 2
hhm try using a string value instead like body { background-color:red; }
25th Feb 2018, 12:33 PM
xdeathbossx
+ 1
could you show me the full code like insert it in
25th Feb 2018, 12:37 PM
xdeathbossx
+ 1
yeah show ys
25th Feb 2018, 12:38 PM
xdeathbossx
+ 1
us*
25th Feb 2018, 12:38 PM
xdeathbossx
+ 1
dude I tried the code did u expect a grey background?
25th Feb 2018, 12:42 PM
xdeathbossx
+ 1
yeah bro i expect it..
25th Feb 2018, 12:43 PM
Christian Jay Medallo
Christian Jay Medallo - avatar
+ 1
well it worked for me
25th Feb 2018, 12:43 PM
xdeathbossx
+ 1
I didn't even need to modify it
25th Feb 2018, 12:43 PM
xdeathbossx
+ 1
is it still not working for you?
25th Feb 2018, 12:46 PM
xdeathbossx
+ 1
bro i will put my code into public can you see it
25th Feb 2018, 12:47 PM
Christian Jay Medallo
Christian Jay Medallo - avatar
+ 1
I can't see it
25th Feb 2018, 12:48 PM
xdeathbossx
+ 1
the code named "oo"
25th Feb 2018, 12:49 PM
Christian Jay Medallo
Christian Jay Medallo - avatar
+ 1
the background color dont work am i right
25th Feb 2018, 12:51 PM
Christian Jay Medallo
Christian Jay Medallo - avatar
+ 1
OK add this to the javascript section window.onload = function (){ document.body.style.backgroundColor = "#C0C0C0";}
25th Feb 2018, 12:52 PM
xdeathbossx
+ 1
so does it work now?
25th Feb 2018, 12:53 PM
xdeathbossx
+ 1
it works now bro.. Thanks for your help i appteciate it
25th Feb 2018, 12:58 PM
Christian Jay Medallo
Christian Jay Medallo - avatar
+ 1
no problem. the reason it didn't work was because the body didn't even load yet when you tried to style it.So,the document does not know whats the body tag and so it can't style it at all. the JavaScript code window.onload makes sure that the code is executed only when everything else has successfully loaded. And so the problem is solved
25th Feb 2018, 1:02 PM
xdeathbossx