tags:

views:

212

answers:

5

I have a an image not covering the background completely of a div. Can I specify the height of the image to make it larger?

transparent url(http://www.example.com/picture.jpg) height=??
A: 

You should only specify the height of the div. And use

repeat

property of background.

If you need to stretch use an image inside the div and make height and width to 100%.

rahul
i don't want to repeat, i want to stretch if possible
chris
+2  A: 

You can not stretch a background image. Well at least you can not reliably do it cross browser today. The future CSS is most likely to support it, IIRC.

You will need to use a <img> element if you want to use the browser to stretch an image, but this is not recommended.

If you are not wanting to stretch the image, but more some of the background image is cut off, then expand the height of the element that has the background with the css property width or height.

alex
A: 

if the background is just a solid color, you can use repeat-y.

Mohamed
+1  A: 

Background images can't be stretched.

Use an img tag with absolute positioning and z-index it behind your other elements.

CB