PDA

View Full Version : background repeat not working (1st ? be gentle pls)



pam2923
23 Nov 2010, 02:10 PM
I've copied what I think are the valid areas of my problem. The image shows up fine, just doesn't repeat. I'm using a combination of Dreamweaver and me (where the problem probably lies). Dreamweaver gives me an error message saying "the tag: "div" doesn't have an attribute: "background-repeat" in currently active versions.[XHTML 1.0 strict]" Is it possible to get the image to repeat?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

snip

#repeater
{
width: 800px;
height: 200px;
margin: 0 auto;
background-color: #FFFFFF;
background: url(images/bottom-repeater.jpg);
background-repeat: repeat-y;
background-position: left top;
}

Wickham
24 Nov 2010, 12:36 AM
Of course there is an attribute background-repeat, but Dreamweaver hasn't explained the problem.

If you state each attribute separately you need the image in background-image:-


#repeater
{
width: 800px;
height: 200px;
margin: 0 auto;
background-color: #FFFFFF;
background-image: url(images/bottom-repeater.jpg);
background-repeat: repeat-y;
background-position: left top;
}

If you use the short version background then all the attributes need to be the short version:-


#repeater
{
width: 800px;
height: 200px;
margin: 0 auto;
background: #FFFFFF url(images/bottom-repeater.jpg) left top repeat-y;
}

(according to the rules the color should be stated first although it will work if after the url. I think it should be first so that if the image doesn't show the color will show).