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.
Thanks for useful tut ;)
Good read!!
I am using this technique on all my designer website projects :).
Tip:- Keep a check on the size of the background image, I have seen a few websites where the background image takes too long to show up and it looks unorganized till the time its fully loaded in the cache.
Regards,
CSSJockey
@Tor, Aaron Bassett
Setting a background for an html tag (thus, forcing the browser to calculate the width and height of the html element) will cause the body tag to be rendered as div and *not* fill the browser window’s full height (only as far as the content goes).
In such cases height/min-height properties should be set additionally.
@Colin
display:table works here because the body is not *shown* as table, but *rendered* as table, i.e. the minimal box width is calculated. No side effect on seo/semantics :-)
@Cédric
Notes for IE6
1. setting expression like property for body’s min-width will fix this issue.
2. In some cases the width of the image needs to be wider than the container’s width.
For example:
* html body {width: expression(document.documentElement.clientWidth < 904 ? "904px" : "auto");
}
Please note that such css selector is not valid so it should be placed in a separate CSS file and linked using conditional comments. 904px is a value for webdesignerwall.com site’s min-width.
Have you heard Chase Talk?
Regards.
@Daxion
Could you please clarify what issues arise in Chrome & Safari?
There might be some issue when printing the page, however print-versions are usually created without backgrounds so for media=”print” display: table is not used.
There *might* be some rendering issues due to the usage of background of html and body at the same time, but these browsers are updated very frequently so this shouldn’t be an issue (early versions of safari 3 for windows did not even render strong tag at all ;-))
Nice explanations
Thanks for the tips…
But i really wanted to find a way to preload a large body bg image using javascript/jquery and make it fade in when its loaded…but i failed.. i used the jquery load(), append() functions,etc.. it worked with images in other divs but not with the body bg… its available in flash, but i didnt find this technique done with javascript. anyone tried this?
..and yeah, keep up man!
What a great tutorial, thanks for this!
I am currently in the process of thinking of what to do with my background…this tutorial definately got me thinking!
http://www.skytemedia.com
Great. This tutorial would have helped much when I tried to put a fixed background on my site.
If anybody is willing to try it, the CSS would look like this:
body {
background: fixed url(‘./images/lacajita.jpg’) no-repeat center;
color: #333333;
}
This way, with “fixed” and without “top”, it stays completely centered, even when you’re seeing just a little part of the website through a small browser window.
This something that has
been in the back
on my mind for some time,
like since win vista
was first promo’d a wide angle
pic looking over a valley on there
site how ever
long ago that was…
I’ve quickly skimmed over this page but
I’ll be coming back to it on my next
site what ever it may be.
btw thanks & also for
the list – very inspiring
http://www.webdesignerwall.com/trends/80-large-background-websites/
cheers
Lollie
i always love when people dissect their sites and show their css tricks to making stuff work.
You are a good send!
Thank you for all the tips and for always being so cutting edge!
I honestly would have never started my own .com Blog if it wasn’t for all the inspiration from this website!
I look forward to every post!
Sweetness! Thanks for the tips. I am not the best with css but I was looking at the code and it looks like you applied the second background image to #page, not #wrapper, is that right? This is a dumb question but do I have to call it Page or Wrapper for it to work? For example, when you specify the cork image it will only show if you enter Body.
Thanks for the tips. Very creative, detailed, and definitely useful!
I would be more careful with huge backgrounds in terms of using website for different browsers – and I’m not talking about chrome/safari issue. Major problem is still pixel rounding which is different in different browsers.
E.g. FF3 will put offset 1px to the left, while IE7 will do it other way plus 1px more. Issue is appearing mainly when ‘center’ is in use.
Personally I found the way doing backgrounds in separate divs (one below body) with ‘top left’ or ‘top right’ (image is still fixed with pixel size, so shouldn’t be any problems with it). That way makes it safer for cross-browssing & saving your time to make fixes in IE.
I hope pixel rounding will be unified one day in all of the browsers (knowing market actually, proofs me wrong).
thank you for your sharing!
Great tips! thanks everybody
Wow quite a useful Tips on Background Image!!!!
cooool
I was just recently wondering how to do the big background CSS image stuff, and bang I find this link on another blog… I should have known it was going to direct me to web designer wall… this site is a freaking wealth of information.
Excellent tutorial, Keep up the good work.
I definitely learned something here. Any tutorial and sharing is good. But one so clear and concise, it rocks! Thanks.