March 14, 200917 yr I am coding my first site and have used the code in the sticky here to center the site which has a width of 960px. The problem is that when I assign a background colour to an element, it only spans across that 960 width, whereas I want it to span across the entire browser window. I tried using a width: 100% tag but it still only spans across the 960 width. Is there anyway to make it span to the browser edges?
March 14, 200917 yr body { background:#000000; } OR - It can't hurt to put a blank wrap around your entire site either, like this: <div id="wrap"> <div id="centered_box">width 960</div> </div> #wrap { background:#000000; } #centered_box { margin:auto: width:960px; background:#ffffff; }
March 14, 200917 yr I think what you want to do is set the body (entire browser window?) to a colour, then set the colour of your wrapper. The example below (using the faq code) gives a red body and blue wrapper - obviously you change colours to suit your design body { text-align:center; background-color: #FF0000; } #wrapper { margin: 0 auto; width: xxxx; /* Replace the xxxx with the the width of your site (eg 800px)*/ text-align:left; background-color: #0000FF; }
Create an account or sign in to comment