PDA

View Full Version : aligning a background image to the middle of a div



lli2k5
Sep 1st, 2007, 05:42 PM
is there anyway to align the background image of a div to the middle of the div, no matter what size the div is?

Say, if you have a div. I would like the background image to stay in the middle of the div, no matter how large the div gets. The reason is that the background-image contains a small graphic that I always want to stay in the center of a div. How would I do that?

harbingerOTV
Sep 1st, 2007, 05:51 PM
.div {
background: #color url(image) center center no-repeat;
}

lli2k5
Sep 1st, 2007, 06:16 PM
thanks, you're the man