css - Nested backface-visibility is not hidden -
i've got problem "nested" backface-visibility
.
i have flipping div, content on both sides. that, use 2 div flipping, each 1 representing face of "two-faces" div (.face
, .back
).
rotation works well.
now, want hide container, , reveal when page loaded flip. can see, .face
div visible.
how avoid .face
visible before animation?
here's shorten working example made (chrome favor):
.flip { position: relative; backface-visibility: hidden; transform: rotatex(180deg); animation: init 1s ease 2s 1 normal forwards; } .flip div { backface-visibility: hidden; transition: 1s; margin: 0; padding: 20px; border: 1px solid; width: 200px; text-align: center; } .back { position: absolute; top: 0; left: 0; } .face, .flip:hover .back { transform: rotatex(0deg); } .flip:hover .face, .back { transform: rotatex(180deg); } @keyframes init { { transform: rotatex(180deg); } { transform: rotatex(0deg); } }
<div class="flip"> <div class="face">face</div> <div class="back">back</div> </div>
if want work in nested way, need property
transform-style: preserve-3d;
in parent:
.flip { position: relative; backface-visibility: hidden; transform: rotatex(180deg); transform-style: preserve-3d; animation: init 1s ease 2s 1 normal forwards; } .flip div { backface-visibility: hidden; transition: 1s; margin: 0; padding: 20px; border: 1px solid; width: 200px; text-align: center; } .back { position: absolute; top: 0; left: 0; } .face, .flip:hover .back { transform: rotatex(0deg); } .flip:hover .face, .back { transform: rotatex(180deg); } @keyframes init { { transform: rotatex(180deg); } { transform: rotatex(0deg); } }
<div class="flip"> <div class="face">face</div> <div class="back">back</div> </div>
Comments
Post a Comment