logo

xDimension (2D) selecteur

HTML :

<div class="hover2deffect">
    <div class="cube">
        <img src="../../all-css/imgTest/10.jpg" alt="truc">
        <span>CSS</span>
    </div>
    <div class="cube">
        <img src="../../all-css/imgTest/2.jpg" alt="truc">
        <span>Image</span>
    </div>
    <div class="cube">
        <img src="../../all-css/imgTest/8.jpg" alt="truc">
        <span>Hover</span>
    </div>
    <div class="cube">
        <img src="../../all-css/imgTest/3.jpg" alt="truc">
        <span>Effect</span>
    </div>
</div>

CSS :

<style>

    .hover2deffect {
        display: flex;
        width: 100%;
        padding: 4% 2%;
        box-sizing: border-box;
        height: 100vh;
    }

    .cube {
        flex: 1;
        overflow: hidden;
        transition: 0.5s;
        margin: 0 2%;
        box-shadow: 0 20px 30px rgba(0, 0, 0, 0.1);
        line-height: 0;
        padding: 1.25em;
    }

    .cube>img {
        width: 200%;
        height: calc(100% - 10vh);
        object-fit: cover;
        transition: 0.5s;
    }

    .cube>span {
        font-size: 3.8vh;
        display: block;
        text-align: center;
        height: 10vh;
        line-height: 2.6;
    }

    .cube:hover {
        flex: 1 1 50%;
    }

    .cube:hover>img {
        width: 100%;
        height: 100%;
    }
</style>