Can css stretch a background image?

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
jamesmusic
Regular
Posts: 46
Joined: Thu Jun 28, 2007 6:50 pm
Contact:

Can css stretch a background image?

Post by jamesmusic »

Is it possible to strech a background image so it fills the page, rather than a repeat tile...? Or is there a cunning way around this problem in css? :wink:
James
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Can css stretch a background image?

Post by garvinhicking »

Hi!

There is no CSS property to stretch a background image. I wonder which graphic you could stretch to fit, which would still look okay? Usually the "key to success" is simple repeating. If you have a real image, and not a pattern, stretching it would really look nasty.

You can use the z-index property and place a <img> element with 100% width containing an image, and use absolute positioning to place it below other elements. But that's really hackish.

Apart from that, you might want to ask thsi question in a HTML/CSS specific forum, since it is little related with Serendipity. :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply