Last active
December 28, 2022 13:47
-
-
Save bsmth/b8b0763389f2948ab6f180bea7441bcf to your computer and use it in GitHub Desktop.
Using 'transform-style' with 2d elements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<style> | |
.wrapper { | |
transform-style: preserve-3d; | |
} | |
.wrapper2 { | |
transform-style: flat; | |
} | |
.box { | |
margin: 10px; | |
height: 100px; | |
width: 100px; | |
line-height: 100px; | |
text-align: center; | |
transition: 0.5s; | |
border: 1px solid; | |
} | |
#box1:hover { | |
transform: scale(2, 0.5); | |
} | |
#box2:hover { | |
transform: rotate(0.5turn); | |
} | |
#box3:hover { | |
transform: scale(2, 0.5); | |
} | |
#box4:hover { | |
transform: rotate(0.5turn); | |
} | |
</style> | |
<div class="wrapper"> | |
<div class="box" id="box1">scale X</div> | |
<div class="box" id="box2">scale X,Y</div> | |
</div> | |
<div class="wrapper2"> | |
<div class="box" id="box3">scale X</div> | |
<div class="box" id="box4">scale X,Y</div> | |
</div> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment