Learn HTML step-by-step from A to Z or improve your professional skills.  Home HTML and CSS Tutorials Css large background

Css large background


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.

image 1

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?

image 2

CSS Part

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

image 3

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).

image 4

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.

image 5

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

image 6

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.

image 7

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.

CSS Large Background

Download the demo zip now and don't forget to check out the Large Background Websites.



Author's URL: Web Designer Wall
Learn HTML step-by-step from A to Z or improve your professional skills. More Tutorials: Featured Materials | Fresh Materials | More HTML Tutorials at Markuptutorials.com

Reader's comments
comments HortonAlissa26 August 30, 2011 says:
I strictly recommend not to hold back until you get enough amount of cash to order different goods! You can just take the <a href=" loans</a> or auto loan and feel yourself free
Reply
comments San Diego Web Guy March 16, 2010 says:
This a WONDERFUL tutorial! Thanks for the demos too! - AndreRyanDesigns.com
Reply
Add comments to "Css large background"

Captcha