Back
Tutorial on how to create a beautiful 3D card with multiple layers, that expands on hover - CSS only.
<button class="map"> <span></span> <span></span> <span></span> <span></span> <span></span> </button> <style> button { transform: rotate(-25deg) skew(25deg); transform-style: preserve-3d; position: relative; width: 10rem; height: 5rem; border: none; margin: 2rem; cursor: pointer; } button:before { content: ''; position: absolute; bottom: -10px; left: -5px; width: 100%; height: 10px; transform: skewX(-41deg); } button:after { content: ''; position: absolute; top: 5px; left: -9px; width: 9px; height: 100%; background: #2a2a2a; transform: skewY(-49deg); } .map:before, .map:after { background: #524017; } button span { position: absolute; top: 0; left: 0; bottom: 0; right: 0; background-position: center; background-size: cover; filter: brightness(40%); transition: 1s; } .map span { background-image: url('https://i0.wp.com/www.psychreg.org/wp-content/uploads/2018/05/three-people-travelling.jpg?fit=626%2C417&ssl=1'); } button:hover span { transition: .3s; filter: brightness(100%); } button:hover span:nth-child(5) { transform: translate(2rem, -2rem); opacity: 1; } button:hover span:nth-child(4) { transform: translate(1.5rem, -1.5rem); opacity: .8; } button:hover span:nth-child(3) { transform: translate(1rem, -1rem); opacity: .6; } button:hover span:nth-child(2) { transform: translate(0.5rem, -0.5rem); opacity: .4; } button:hover span:nth-child(1) { transform: translate(0px, 0px); opacity: .2; } </style>Thank you for reading this article.