Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Position absolute in table-cell with Internet Explorer

I have a table structure and I need the nested element to take all the size of the table cell div. So I put it to absolute and define all its positions to 0, it works great on FireFox and Chrome but not on IE :(

Here is the markup :

<div class="table">
    <div class="cell">
      <figure class="illustration">My illustration</figure>
    </div>
</div>

The CSS :

.table {
    display: table;
    width: 400px;
}

.cell {
  position: relative;
    display: table-cell;
    height: 600px;
    background-color: grey;
}

.illustration {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: red;
    color: #fff;
}

Here is my pen : http://codepen.io/balix/pen/qEMwzj

If you see the red background it's ok ;)

Any hack for IE ?

like image 835
Balix Avatar asked Mar 10 '15 10:03

Balix


1 Answers

I had the same problem. In case some one is still looking for a workaround you need to create a container inside .cell with

.cell > div{
    height:100%;
    width:100%;
    position:relative;
}
like image 100
Jacopo Mori Avatar answered Oct 07 '22 15:10

Jacopo Mori