tags:

views:

45

answers:

2
html { 
    background: #9c9c9c url(../images/bg-bottom.jpg) center top;
}
body {
    border-top:2px solid #fecd2a;
    background:#9c9c9c url(../images/bg.jpg) repeat-x center bottom;
}

I need bg.jpg which is the large background with the black gradiantat the top, to be at the top and for the bg-bottom.jpg to be repeated at the bottom. How come this doesn't work, is there and easier way? Apart from creating one long image.

http://fluroltd.com/clients/harveys/latest-news/

A: 

Your CSS on the body should be

background: url("../images/bg.jpg") repeat-x scroll #9C9C9C;

I don't think adding a background to your HTML tag is going to get you anywhere. If I were you I would just make one super long, narrow-width image that will not possibly be exceeded by the length of your page. You can't have multiple BGs without using CSS3, which I personally wouldn't recommend.

Squirkle
Yes it will. Any background that's set on the `html` element should show through any transparent parts of the `body` element.
derekerdmann
Is it better to put the color at the end or is it just preference? background: url("../images/bg.jpg") repeat-x scroll #9C9C9C;
Solidariti
To my knowledge, it doesn't make any difference.
Squirkle
I believe both are valid statements which state a different thing with the same result - color first sets the background-color, background-image, background-repeat and background-attachment - which means the color is only used if the image ins unavailable. Color last sets the background-image, background-repeat and background-attachment, and additionally states that if the browser is unable to use these settings, it should use another set: a set only containing a background-color.
Jasper
Interesting thank you for that.
Solidariti
+1  A: 

Looks like you need to switch around your positioning and use a transparent background for the body tag:

html {  
    background: #9c9c9c url(../images/bg-bottom.jpg) center bottom 
} 

body { 
    border-top:2px solid #fecd2a; 
    background: transparent url(../images/bg.jpg) repeat-x center top; 
} 
derekerdmann