Question

I have this snippet implemented:

CSS

div
{
    position:absolute;
    -webkit-transition: all 0.3s ease-out;
}
.block
{
    background:#fc0; /* YELLOW */
    top:50px;
    left:50px;
    width:80px;
    height:40px;
    -webkit-transform: rotate3d(1,0,0,-55deg) rotate3d(0,0,1,30deg);
}
.block .part
{
    background:#444; /* GREY */
    width:inherit;
    height:inherit;
    -webkit-transform: translate3d(0,0,50px);
}
.block:hover .part
{
    -webkit-transform: translate3d(10px,10px,20px); /* ONLY TRANSFORMS X & Y */
}

HTML

<div class="block">
    <div class="part"></div>
</div>

Check out this Fiddle for the live example.

As you can see, the translation on :hover only affects the .part on the x- and y-axis.

It won't translate in the z-direction.

Anyone who knows what I'm doing wrong?

Was it helpful?

Solution

Got it. Forgot to add -webkit-transform-style: preserve-3d;

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