通过 jQuery 这么写:
$(
'.xx'
).css({
'background'
:
'url( no-repeat 50%'
,
'background-size'
:
'auto 100%'
});
执行之后会让‘.xx’的样式如此呈现:
.xx{
background
:
url
(http://www.xx.com/xx.jpg)
50%
50%
/
auto
100%
no-repeat
}
上面的不可以的话,下面的绝对可以:
background:#f00 url(background.gif) no-repeat fixed 0 0/100px 100px;