I have an HTML table with an object element and a span tag inside one td parent tag like so:
HTML:
<table class="tableClass">
<tr>
<td class="tdClass"><object data="http://mydata.com"></object><span>My Text</span></td>
</tr>
</table>
Now the table has a background color of #999. Basically, with z-indexing, I want the element to hide behind the element, but the span element should be on top of the #999 table background. How do I achieve this?
My CSS:
.tableClass{
background: #999;
}
.tdClass object{
z-index:999;
}
.tdClass span{
position: absolute;
z-index: 1; (if I make it -1, it disappears behind the table background...)
}
Currently the span element with the text is on top of the object element…I want it behind the object element and infront of the table background.
Thank You
.tdClass objectneeds at leastposition:relative, asz-indexwill only work on block-level elements which aren’tposition:static. Try the following:See also CSS2.1: 9.9.1 Specifying the stack level: the ‘z-index’ property: