Click to See Complete Forum and Search --> : The background for the DIV wont show


snowman222
01-01-2009, 09:40 PM
OK, in the site I have the body background an image (just a subtle grey really).And I want to put this picture i have as the background for a couple of the DIVs. So I use the same code as I did for the body background (just change the name). But now It wont show the DIV background, even though the body background works fine.

heres what I used for the body background...

body{
background-image: url(site backgroud/images/tile.gif;)
}

and the DIV Background...

.box{
background-image: url(div background/images/tile.gif;)
border: 1px solid black;
}

All i want is the DIV background to show once (its a pic of a blank piece of notebook paper) but be the size of the boxes that I put around the DIVs.

Any ideas???

Kor
01-02-2009, 02:40 AM
.box{
background:url(background/images/tile.gif) no-repeat 0 0;
}

learn CSS:
http://www.w3schools.com/css/pr_background.asp

Major Payne
01-02-2009, 02:52 AM
Believe you need to set a width/height for the div container that fits your image.

.box {
width: XXpx;
height: YYpx;
margin: 0 auto; /* Use only to center div in its container */
background: #fff url(background/images/tile.gif) no-repeat center scroll;
border: 1px solid #000;
}

Change "#fff" for background color or remove if not wanted. If that is a tileable image:

background: #fff url(background/images/tile.gif) repeat left top scroll;

snowman222
01-02-2009, 11:40 AM
ok, i understand. but it still doesnt work

Major Payne
01-02-2009, 04:29 PM
Any link to problem page. Noticed in original post that you called out the same image for both the body and div container. Or was that just an example you used? If no page online, do you at least have a link to image used or attach it here????

snowman222
01-02-2009, 04:43 PM
The thing is it wont let me upload either of them because they exceed the amount of MB allowed and I cant remember the url for the DIV background.

They are both images saved on my computer, the names are "site background.bmp" and "div background.jpg"