Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DIV over table cell (Firefox issue)

Tags:

html

css

I want div to be appeared over table cell (filling the entire space of the cell, div width=100% and height=100%) on mouseover event.

In IE8 and Chrome it looks like i want it to be, but in Firefox div appears beyond the boundaries of the table cell.

Code example on jsfiddle

like image 580
user947668 Avatar asked Jun 17 '26 05:06

user947668


1 Answers

You use position: relative; on the td element. Firefox ignores this value on table cells, see this bug.

To circumvent this beahaviour you can create a single child of the td which serves as a wrapper.

<td>
    <div class="table-cell-wrapper">Your absolute positioned content here</div>
</td>

And with this CSS you give the wrapper the dimensions of the table cell.

.table-cell-wrapper {
    position: relative;
    height: 100%;
    width: 100%;
}

I updated yout jsfiddle here http://jsfiddle.net/RDq8Q/2/. You need to adjust the exact posionting again, but yout overlay works now.

like image 60
Jona Avatar answered Jun 20 '26 01:06

Jona



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!