Roman
Roman

Reputation: 4513

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 like 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.

Upvotes: 0

Views: 13711

Answers (1)

Spiny Norman
Spiny Norman

Reputation: 8327

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.

Upvotes: 1

Related Questions