Question

I am trying to make a line that have 3 columns to have a hover effect that shows the item description.

On Google Chrome, when I hover the first item, the gap appears between the second and the third column. On Mozilla Firefox the same thing happens when it's 4 or 2 columns instead of three, the gap appears between the two last items.

Markup

<div class="row row-3">
    <div class="column">
        <img src="http://placehold.it/800x650" alt="" class="image" />
        <div class="info">
            <p class="description">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
        </div><!-- .info -->
    </div><!-- .column -->

    <div class="column">
        <img src="http://placehold.it/800x650" alt="" class="image" />
        <div class="info">
            <p class="description">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
        </div><!-- .info -->
    </div><!-- .column -->

    <div class="column">
        <img src="http://placehold.it/800x650" alt="" class="image" />
        <div class="info">
            <p class="description">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
        </div><!-- .info -->
    </div><!-- .column -->
</div><!-- .row -->

CSS

body {
    font: normal 0.7em sans-serif; }
.row {
    width: 100%; }
.image {
    max-width: 100%; }
.info {
    background: rgba(0, 0, 0, .5);
    color: #FFF;
    height: 100%;
    left: 0;
    opacity: 0;
    position: absolute;
    top: 0;
    transition: all .3s linaer;
    width: 100%;

    -webkit-transition: all .3s linear;
    -moz-transition: all .3s linear;
    -ms-transition: all .3s linear;
    -o-transition: all .3s linear; }
.column:hover .info {
    opacity: 1; }
}
.column {
    position: relative; }
.row-3 .column {
    float: left;
    width: 33.333333%; }

I made a fiddle to show the issue: http://jsfiddle.net/q5z4B/1/

Was it helpful?

Solution

The problem is the 33.333333% you have use as width. The browser takes some time to calculate the "100%" of "33.33333%" that the image needs to fill the container.

Probably if you change the image width to 100.1% insteed of 100% it may work

OTHER TIPS

Just add this CSS properties to .image element

    .image
    {
     margin: 0;
     padding: 0;
     display: block;
    }

Check JSFiddle

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top