将整个内联块div设置为超链接

Sha*_*ang 5 html css

这是CodePen。我想使整个多维数据集(div)充当超链接。我可以通过环绕它来实现。但是,由于多维数据集具有display: inline-block;,因此超链接实际上也将包装到多维数据集下方。如果将鼠标悬停在多维数据集下方,则可以找到它。

在保持立方体不变的同时,我该怎么做才能消除底部的链接inline-block

这是代码:

<a href="example.com" target="_blank">
    <div class="cube">
        <div class="flippety">
            <h1>Flippity</h1>
        </div>
        <div class="flop">
            <h2>Flop</h2>
        </div>
    </div>
</a>
Run Code Online (Sandbox Code Playgroud)
/* Set-up */
body {
    color: rgb(6, 106, 117);
    text-transform: uppercase;
    font-family: sans-serif;
    font-size: 100%;
    background: #F4F6F8;
    padding: 3em 0 0 0;
    line-height: 62px;
    -webkit-perspective: 1000px; 
}

/* Container box to set the sides relative to */
.cube {
    display: inline-block;
    width: 30%;
    text-align: center;
    margin: 0 auto;
    height: 200px;

    -webkit-transition: -webkit-transform .33s;
    transition: transform .33s; /* Animate the transform properties */

    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d; /* <-NB */
}

/* The two faces of the cube */
.flippety,.flop {
    background: rgb(247, 247, 247);
    border: 1px solid rgba(147, 184, 189, .8);

    -webkit-border-radius: 5px;
    border-radius: 5px;

    -webkit-box-shadow: 0 5px 20px rgba(105, 108, 109, .3), 0 0 8px 5px rgba(208, 223, 226, .4) inset;
    box-shadow: 0 5px 20px rgba(105, 108, 109, .3), 0 0 8px 5px rgba(208, 223, 226, .4) inset;
    height: 200px;
}

/* Position the faces */
.flippety {
    -webkit-transform: translateZ(100px);
    transform: translateZ(100px);
}

.flop {
    -webkit-transform: rotateX(-90deg) translateZ(-100px);
    transform: rotateX(-90deg) translateZ(-100px);
}

/* Rotate the cube */
.cube:hover {
    -webkit-transform: rotateX(90deg);
    transform: rotateX(90deg); /* Text bleed at 90º */
}
Run Code Online (Sandbox Code Playgroud)