html {
background: yellow;
}
The reason it doesn't work here is that there is no document.html
property. You either can reference the element via
document.documentElement or just via "html" selector:
$("html").css("background", "yellow");
--Klaus
On 2 Jan., 17:16, "Andy Matthews" <li...@commadelimited.com> wrote:
> That's because you can't set the background color of the HTML tag. It
> doesn't have that attribute. Even if you could do that, one would override
> the other.
>
> What you probably want to do is to set the bg of the body tag, then set the
> bg of a container INSIDE the body like so:
>
> <body>
> <div></div>
> </body>
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
>
> Behalf Of BlueStunt
> Sent: Friday, January 02, 2009 9:29 AM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] How to set the HTML background
>
> I want to be able to change the background of the page,
>
> I can successfully do
>
> $(document.body).css("background", "yellow");
>
> but I have two separate css backgrounds, one sets the body tag and one sets
> the html tag.
>
> So how do I set the html tags background
>
> I've tried
>
> $(document.html).css("background", "yellow");
>
> but it won't work :/
> --
> View this message in context:http://www.nabble.com/How-to-set-the-HTML-background-tp21252706s27240...
> 06.html
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.
No comments:
Post a Comment