+ 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
28 Answers
+ 3
could you show the code?
maybe I could help then.
+ 2
cause then I could find your mistake
+ 2
Show us the code so that we may debug it.
+ 2
hhm try using a string value instead like
body {
background-color:red;
}
+ 1
could you show me the full code like insert it in
+ 1
yeah show ys
+ 1
us*
+ 1
dude I tried the code did u expect a grey background?
+ 1
yeah bro i expect it..
+ 1
well it worked for me
+ 1
I didn't even need to modify it
+ 1
is it still not working for you?
+ 1
bro i will put my code into public can you see it
+ 1
I can't see it
+ 1
the code named "oo"
+ 1
the background color dont work am i right
+ 1
OK add this to the javascript section
window.onload = function (){
document.body.style.backgroundColor = "#C0C0C0";}
+ 1
so does it work now?
+ 1
it works now bro.. Thanks for your help i appteciate it
+ 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