December 14, 201015 yr Hello people, I am trying to create a website header using dreamweaver cs5 and css like the one at www.bottlerocketcreative.com. I have tried placing 2 background images using css for the black banner set to repeat-x and the bg texture set to repeat (x and y). I have also tried to make an image which contains a banner and the logo in the centre and then placed a wrapper div around the centred div, which has just the black texture. Both of these didn't work Does anyone know an effective way to do this?? Any help would be much appreciated. Thanks in Advance Ajit
December 14, 201015 yr If you want two background images you can place one in the html style and the other in the body style. Put the repeating x image in html html { background: url(image1.jpg) repeat-x; } body { background: url(image2.jpg) top center fixed no-repeat; } Or you can put one in the body style and the other in a page wrapper div. Does that help? Edit. You had two options in your post but you can use the same principle. For the first, the html background would have the "repeat" style to repeat both x and y (or just don't state repeat as it's the default) and the body style would have the repeat-x. Edited December 14, 201015 yr by Wickham
December 14, 201015 yr if you looked at the bg image, its all one image. They have determined the size of the webpage, then made the image to suit. Link to bg image: http://www.bottlerocketcreative.com/assets/img/bg-main.jpg# Then add divs with margins to position the elements of the website
December 14, 201015 yr OK, I missed that. So if the OP is using an image like that (1200*1550) he could put the textured background-image in the html style to repeat over the whole page and the image in the body style with fixed top center no-repeat and then the html texture would fill in at the sides when the resolution is over 1200px wide. If it's just a black background-color that's wanted around the image, then it can all be done in the same tag:- body { background: #000000 url(image.jpg) top center no-repeat fixed; } I have also tried to make an image which contains a banner and the logo in the centre and then placed a wrapper div around the centred div, which has just the black texture. html { background: url(texture.jpg); } body { background: url(banner.jpg) top center fixed no-repeat; } #wrapper { background: url(logo.jpg) top center fixed no-repeat; } Edited December 14, 201015 yr by Wickham
December 14, 201015 yr There is also a very common issue happens mostly if you give your main wrappers postion: absolute or relative, the background image in body gets disappear. I have seen many people stuck with it. in such situation giving height or min-height to body solves the problem
December 14, 201015 yr Author Hi everyone, Thanks for your replies i really appreciate your help. I have made an image similar to the 1200 x 1550 and places this in the body tag as top center fixed no repeat and places the image in the html tag as repeat-x but there is a gap between the tiled images? Is there a way to get rid of that? i tried, margin:0; and border:0;, both didn't work. I am assuming div tags or tables would have to centred relative to the browser. Thanks Ajit Edited December 14, 201015 yr by asp24
December 14, 201015 yr If there is a gap between the repeating bits of a background-image, you should take a close look at the image, because the space may be around the edge.
December 14, 201015 yr Author Hi again, Ignore the last comment got it working now!! Thanks So much for your help Ajit
December 14, 201015 yr Author If there is a gap between the repeating bits of a background-image, you should take a close look at the image, because the space may be around the edge. That was exactly it wickham, thanks again.
December 14, 201015 yr OK, I missed that. So if the OP is using an image like that (1200*1550) he could put the textured background-image in the html style to repeat over the whole page and the image in the body style with fixed top center no-repeat and then the html texture would fill in at the sides when the resolution is over 1200px wide. If it's just a black background-color that's wanted around the image, then it can all be done in the same tag:- body { background: #000000 url(image.jpg) top center no-repeat fixed; } html { background: url(texture.jpg); } body { background: url(banner.jpg) top center fixed no-repeat; } #wrapper { background: url(logo.jpg) top center fixed no-repeat; } lol no worries, just thought id point it out. Thats the first thing i look at when it comes to bg image issues lol
Create an account or sign in to comment