Stretch an image in a div background
I have a div with a background image - and I want it to stretch as the div itself stretches.
My CSS is lik开发者_运维问答e this:
.infobox-medium-text
{
width: 473px;
height: 208px;
background: url(../../images/infobox/infobox-medium.png) top no-repeat;
float:left;
}
where as a div receives the .infobox-medium-text
class.
Thanks.
Have a look here: Stretch and scale a CSS image in the background - with CSS only
EDIT: If you want this technique to work on a div
instead of the body
, add position: relative;
to the div
's css.
精彩评论