user1280853
user1280853

Reputation: 1169

Firefox not using position:relative with table-cell

I am having a problem with firefox, using position relative on a div that has been given a display of table-cell, firefox is ignoring the position relative so my absolutely positioned elements inside the table cell are not showing correctly. You can see my example page at: http://dev.aaronpitts.ch/lhc/ it works fine in webkit etc so you can see what I am trying to achieve. Trying this did not help: http://wisercoder.com/firefox-displaytable-cell-and-absolute-positioning/

My affected code is:

<div class="css-table">
<article id="crystallization">
    <a href="#"></a>
    <h2><i class="fa fa-arrow-circle-o-right icon-margin-r"></i> Crystallisation</h2>
    <div class="service-hover">
        <p>1) A comprehensive approach , from conceptualization & development through to realization</p>
        <p>2) ^^ for global/hospitality projects</p>
        <p>3) Our full range of services provide unique knowledge on the management of hospitality professionals, securing sustainable returns for your investments</p>
    </div>
</article>
<div class="cell-space"></div>
<article id="consulting">
    <a href="#"></a>
    <h2><i class="fa fa-arrow-circle-o-right icon-margin-r"></i> Consulting</h2>
    <div class="service-hover">
        <p>1) Extensive industry experience and knowledge, combined with the ability to listen</p>
        <p>2) Our integrative product offering provides you with innovative solutions that meet your specific needs</p>
    </div>
</article>
</div>

And the css:

    .css-table {
    display: table;
    width: 100%;
}

    #management-consulting article {
    background-size: cover;
    background-position: center center;
    position: relative;
}

    #management-consulting article a {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
}

    #management-consulting article:hover h2 {
    opacity: 0;
    -webkit-transition: all 0.5s ease-in-out;
    -moz-transition: all 0.5s ease-in-out;
    -o-transition: all 0.5s ease-in-out;
    transition: all 0.5s ease-in-out;
}

    #management-consulting article h2 {
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    position: absolute;
    color: #FFF;
    font-weight: 200;
    text-transform: none;
}

    #crystallization {
    width: 60%;
    display: table-cell;
    background-image: url(../img/crystallization.jpg);
    height: 400px;
}

    #crystallization h2 {
    bottom: 30px;
    right: 30px;
}

    .cell-space {
    width: 2%;
    display: table-cell;
}

    #consulting {
    width: 35%;
    background-image: url(../img/consulting.jpg);
    display: table-cell;
}

    #consulting h2 {
    top: 30px;
    left: 30px;
}

    .service-hover {
    opacity: 0;
    background: rgba(0, 0, 0, 0.7);
    padding: 30px;
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    font-family: "ff-dagny-web-pro",sans-serif;
    font-style: normal;
    font-weight: 200;
    font-size: 20px;
    font-size: 1.25rem;
    color: #FFF;
}

    #management-consulting article:hover .service-hover {
    opacity: 1;
    -webkit-transition: all 0.5s ease-in-out;
    -moz-transition: all 0.5s ease-in-out;
    -o-transition: all 0.5s ease-in-out;
    transition: all 0.5s ease-in-out;
}

Upvotes: 0

Views: 325

Answers (1)

Boris Zbarsky
Boris Zbarsky

Reputation: 35064

Gecko doesn't support table-cells being absolute containing blocks at the moment. See https://bugzilla.mozilla.org/show_bug.cgi?id=63895

Note that the relevant spec text here is at http://www.w3.org/TR/CSS21/visuren.html#choose-position and says:

The effect of 'position:relative' on table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell, and table-caption elements is undefined.

Upvotes: 1

Related Questions