September 9, 201016 yr Hello everyone. I'm currently designing a website that has a single background image defined within my css. body {background:url(images/bg_image.jpg) no-repeat #040303; } This serves me well at certain resolutions. My problem is though, at higher resolutions, a black void will begin to appear to the right (See image attachment). One technique that I've previously used is to create a 5 pixel wide repeating image based on the the background image, and it's worked perfectly, but the way I've written the CSS this time around doesn't seem to allow that? Does anyone have any suggestions? I'd really appreciate any help towards this. Thank you, Chris.
September 9, 201016 yr Hmm cant quite work out whats going on with your picture, but if you want the background-image to repeat just remove the 'no-repeat' part, or state 'repeat' instead. Hope this helps.
September 9, 201016 yr Author Thanks for getting back to me mrchristoph. I understand what you're saying, but unfortunately that would result in the main background image being repeated and it can look quite unsightly at higher resolutions. Just to reiterate this is purely needed to get rid of that black void to the right so rather than just repeating the whole background image, I take a slice of that image of about 5px, and repeat that on the x axis. As I suggested above, One technique that I've previously used is to create a 5 pixel wide repeating image based on the the background image, and it's worked perfectly, but the way I've written the CSS this time around doesn't seem to allow that? Is anyone else familiar with this technique? Please let me know if I'm not being clear enough. Thanks, Chris.
September 9, 201016 yr Can you link us to your site so we can see the code? That makes things easier to decipher
September 9, 201016 yr you can have 2 background images. have your larger background image onthe body tag: body {background:url(images/bg_image.jpg) no-repeat #040303; } but you can also have a background image on the html tag that will sit behind your body tag. So you can have a repeated background image on the html tag and a larger bacground image on the body tag. html {background:url(images/bg_image.jpg) repeat-x; }
September 9, 201016 yr The simplest method is to use a graphics program such as GIMP and use the dropper tool to get the hex value of the colour right on the edge of the background, change the #040303 for the red colour and it should look ok. Otherwise you will require 2 divs nested with the full width div having a sliced background of 5px repeated and the inner div as the size you want. Have you considered centering the page too? I often use this structure: <div id="headerbg"> <div id="header"> </div> </div> <div id="contentbg">... etc css would be: headerbg {width: 100%; overflow: hidden} header {width: 960px; margin: 0 auto}
Create an account or sign in to comment