"transform: translateZ" not working as intended even when "transform-style: preserve-3d" is set
I'm having difficulties following Kevin's "3D tilting card Effect..." tutorial, I have a container that follows the mouse perfectly but I want the children of the container to have a translateZ set so they look like they are hovering above the container, the problem I am having is that, even when "transform-style: preserve-3d" is set on the container, the translateZ property on the children is not working as intended, children just seem to scale up.
I have a layout comparable to this in my main svelte file
and this is the relevant sass
Any ideas are appreciated, thank you.
19 Replies
this is what I see when translateZ is set to 50px
and this is it set to 500px
as you can see, something is happening but rather than the children moving along the z axis, it just looks like they are spilling over the edges of the container
ig z-index wud be what ur looking for in this case bit im not sure
its not
even if it was positioned absolute, the children would always be on top
are u using
isolation:isolate;
?no, should that be on the container or the children?
ye
which one?
container
alr 1 sec
no change, whats that supposed to do?
its supposed to isolate the z indexs of the container from the rest of the pg
yeah ok, pretty certain z indexes aren't relevant in this context
tried it tho
can u give the whole code
this is in a svelte file so some of the syntax might be weird if you have never seen it
Solution: "backdrop-filter: blur()" is not compatible with "transform: translateZ()" for some reason. If any element had the blur property, the entire thing would flatten.
I'm having a similar problem. I use a box-shadow, is that this "backdrop-filter:blur()"? I couldn't see that in the code above, so wondered if this is what's causing none of my translateZ to work
I don't think that that is true.
If you can provide the code in a Codepen it might be easier for somebody to take a look.