PDA

View Full Version : Div's and images



ajith_rock
Sep 4th, 2007, 08:35 AM
Hey,

I face a problem which i guess many over here would have faced and solved. I have a div in which i use a background image. Now when i increase the resolution and view it in a bigger screen, the background image doesnt stretch!. Generally we use an image inside a div with <img> tag and set the image height and width to 100% for it to stretch. But with the image being used inside the div as the background, i am unable to do it!!. Do any one of you have a solution which could possibly make the background image stretch along with the div?. Incase i confused you here is the code snippet.

style sheet::

.div1
{
width:100%;
height:4.76%;
border-bottom:1px solid gray;
background-image: url(../images/header-aqua.gif);
}

All i need is to make the background image stretch and occupy the entire height of the container div.

Thanx a lot in advance!!

Cheers,

Ajith

abduraooft
Sep 4th, 2007, 10:49 AM
The functionality (background-size: ) is in CSS3, but unfortunately no browsers support this property at this time.
Have a look at http://webdesign.about.com/od/css3/f/blfaqbgsize.htm
where they provided some fake methods to simulate the same by playing around z-index of an <img> element.