Since I posted the huge collection of Large Background Websites, I received several email requests on how to make a large background site with CSS. So, I thought it would be a good idea to share my techniques on designing large background websites. In this tutorial, I will provide various CSS examples on how you can create a large background site using either a single or double images.
Common Mistake: Background Gets Cropped (see demo)
Take a look at the demo file, it looks fine under 1280px. But if you have a high resolution display, you will see the background gets cut off on the sides.

Example #1: Single Image (see demo)
A quick solution to fix the problem mentioned earlier: make the edge of the image the same color as the BODY background color. Here, I'm going to use Web Designer Wall as an example. Take a look at the image below and notice the edge is a solid color?

CSS Part
The CSS part is very simple. Specify the background image (position it center, top) for the BODY element.

Here is the CSS code:
body {
padding: 0;
margin: 0;
background: #f8f7e5 url(wdw-bg.jpg) no-repeat center top;
width: 100%;
display: table;
}
Notice there are two extra lines in the BODY selector. That is to prevent the background image from shifting when you resize the browser smaller than the content width (it happens in Firefox).

Example #2: Double Images (see demo)
For this example, I'm going to use the job board design, Design Jobs on the Wall. I have a cork board pattern repeating in the BODY tag and a wrapper background in the center.

The trick here is to export the GIF matte with a brown color that is similar to the cork board pattern.

Example #3: Sky Background (see demo)
In this example, I have a 1px gradient that is repeated horizontally for the BODY tag. Then I attached a cloud background in the center of the #wrapper tag.

Update: Sky Background Using HTML Selector (see demo)
Thanks to the comments from the readers. Below is an example of the sky background using HTML selector to display the gradient background, so the #wrapper DIV tag is not required. It is a much more cleaner approach.

Download the demo zip now and don't forget to check out the Large Background Websites.
Credits: thanks to Alex from markup4u.com for the {width: 100%; display: table} CSS trick.
That double background image trick is excellent. Is there a reason why display:table works for this? As in, the element is bigger than the display but doesn’t make the browser scrollbars appear. The W3C CSS spec isn’t that clear on display: table’s unique traits, other than it makes the element display as a table!
Nick, you should also write an article about optimizing your large background image since yours clocks in at 172kb: http://www.webdesignerwall.com/wp-content/themes/wdw/images/main-bg.jpg
Or Matt’s (who more or less ripped of your site) who’s image is 130kb+
http://s.ma.tt/blog-content/themes/mahtete/img/bg_container_2col.jpg
BTW I also use the large BG technique on my website.
Wow… thank you sooooo much….. am surely going to redesign my website based on these guidelines and design.
Rather than place the 2nd background image on a wrapper div could we not place it on the body tag and place the 1st background image on the html tag?
Hi
Great article about this technics… But it seems there’s a problem with IE 6.0 and smaller displays than backgrounds (the background isn’t centered as good as it should to be, and is docked on the left !)
Have you a solution for that ?
For sites that need to background images, much like the last example with a gradient and the sky, i would set the html selector’s background to the gradient and the body to the sky image.
No need for so many nested divs. They both do the job though.
Very Nice
Great tutorial, and so timely! I’m teaching an intermediate-level Web Design class, and will be sure to send them here shortly. I’ve not used the display:table CSS property before in this context–I’ll have to look into it more now to see how others are using it.
Very nice. Thanks for sharing.
Very nice, quick tutorial.
Very good, this site provides really good stuff always. I’d like to point that
width: 100%;
display: table;
may arise some background positioning issues when used in Chrome & Safari.
How small or large can one go for the weight of each page? It seems people can take larger downloads now, but I wonder if there is a study on the average kb per page that results in a good recommendation for designers and developers…
How did you create the background image? I can keep looking at it for a long time. Good luck, dude.
Real nice – type of stuff I can’t visualize or realize I have liked until someone comes along and spells it out for me. Thanks very much.
Simply amazing, the grapich tech tutorial are so easy to understand, thanks for this tutorial!
Great, will be useful for many!
Nice tutorial. maybe you can help me.
I’ve been doing the full background stuff for yonks but I have only recently noticed a horrendous problem.
I like to position my menus over the background graphic for nice effects.
Well that’s all rather splendid until someone changes the text size in the browser, then all sorts of problems occur.
Is there any code which does a sort of noresize for text?
yours confusedly…….Stephen
oops, just changed the screen to less than 100% with mse and your page goes out of alignment
Thanks, it’s great tutorial, for a long time i was searching this
Gracias, es un gran tutorial, por mucho tiempo yo buscaba esto.
that’s a great way to learn people about your CSS news templates. Thank you very much for the fun and quick tutorials. You help the search engines and the community with a lot of good content. This is exactly what the Internet is looking for. I will recommend your CSS layout website anywhere on the web thank you very much. I have a coin massage therapy website and a blog that’s attached to it and maybe offering free tutorials on how to build a better website for the search engines these toils will be coming out soon. http://www.kauaimassages.com/blog