Discussion:
DOM bug or feature?
Colin Kincaid Williams
2011-12-01 22:37:34 UTC
Permalink
Hi,

I'm setting my page background via javascript by DOM reference
document.body.style.background="#f3f3f3 url('/images/xenopus.jpg')
no-repeat center fixed";

It sets the background image properties as expected . I'm also trying to
change the background image size

body {
background-size: 20% auto;
}

however, the background image size does not seem affected. However it does
seem to work in webkit browsers. I tested chrome, and somebody else told me
it works in safari.

Document.body.style.background doesn't have option for background size, why
is the background-size not applying? Is this a bug or does it have to do
with firefoxen dom traversal? The page in question is
http://freediscord.com/usingBodyBkgrnd.html .

Furthermore, I noticed in firebug it shows the CSS set as:

element.style { background: url("/images/xenopus.jpg") no-repeat fixed
center center #F3F3F3; }
body { background-size: 20% auto;}

So shouldn't my background-size be set? Is this a bug or is this how its
supposed to work. I'd really like to get it working in both webkit and
gecko....
Sorry if this is the wrong place for my question.

Best,

Colin Williams
Boris Zbarsky
2011-12-02 01:31:25 UTC
Permalink
Post by Colin Kincaid Williams
Document.body.style.background doesn't have option for background size, why
is the background-size not applying? Is this a bug or does it have to do
with firefoxen dom traversal? The page in question is
http://freediscord.com/usingBodyBkgrnd.html .
This seems to work fine for me in both Firefox 8 and a current Aurora
build. What Firefox version did you test?
Post by Colin Kincaid Williams
element.style { background: url("/images/xenopus.jpg") no-repeat fixed
center center #F3F3F3; }
body { background-size: 20% auto;}
So shouldn't my background-size be set?
Set where?

-Boris

Continue reading on narkive:
Loading...