z-index Q
- Started
- Last post
- 5 Responses
- pockets
i have a div with a background image and that div also has text, is there a way to get the background image to be infront of the text ?
think of a div with a price in it, but the price is discounted so there is a slash over the price..
thoughts?
- pockets0
it would have to be 2 divs?
<div id="price">
$99.00
<div id="price slash">
<img src="slash.jpg" />
</div>
</div>?
- BabySnakes0
<div style="position:relative;">
$99.00
<img src="slash.jpg" style="position:absolute; top:0; left:0;z-index:10;"/>
</div>but put them in classes...inline style for show only
- elahon0
I would do:
<div id="price">
<p>$99</p>
</div>
<div id="price-tag">
</div>CSS
#price {
position: relative; z-index: 1;
}
#price-tag{
position: absolute; z-index: 10; background: url(../images/price-tag.jpg) top left no-repeat;
}
- pockets0
thank you, got it...
cheers, happy friday