2

I have a background image with size 1x947 px,

the problem is it's a gradient color, so i only use repeat-x, but when the page height over 947 px, it shows it background color,

background-image:url(bg.gif);
background-repeat:repeat-x;

how to stretch it?

enter image description here

here's the code example on fiddle http://jsfiddle.net/K9cUd/1/

4

2 回答 2

5

Hard to tell without the code or an example.

You could use CSS3's

background-size: 100%;

which should stretch it to the entire page size.

You might need to do

background-size: 0 100%; or background-size: 0% 100%;

so the width does not change.

You can read more here: http://webdesign.about.com/od/styleproperties/p/blspbgsize.htm

And the spec: http://www.w3.org/TR/css3-background/#the-background-size

于 2011-09-08T02:53:29.340 回答
0

如果您不想使用百分比,请使用:

    background-size: cover;
于 2016-02-25T02:51:26.240 回答