Делам разметку HTML:
Пишем стиль:
Результат:
HTML:
<div class="cube_container">
<div class="cube">
<div class="cube_face front_cube">
Front
</div>
<div class="cube_face back_cube">
Back
</div>
<div class="cube_face right_cube">
Right
</div>
<div class="cube_face left_cube">
Left
</div>
<div class="cube_face top_cube">
Top
</div>
<div class="cube_face bottom_cube">
Bottom
</div>
</div>
</div>
CSS:
*{
box-sizing: border-box;
padding: 0;
margin: 0;
}
body{
padding: 0;
margin: 0;
font-size: 2rem;
/* border: 3px solid black; */
height: 100vh;
width: 100vw;
display: flex;
justify-content: center;
align-items: center;
font-family: arial, sans-serif;
font-weight: 600;
/* letter-spacing: 5px; */
}
.cube_container {
/* height: 90%;
width: 90%; */
/* border: 2px solid black; */
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
flex-wrap: wrap;
/* background: black; */
border-radius: 5px;
transition: all ease 0.5s;
}
.cube_container:hover {
box-shadow: 0px 5px 8px 3px rgba(0,0,0,0.5);
transform: scale(1.1);
/* border: 1px solid rgba(0,0,0,0.7); */
}
.cube_face {
margin: 10px;
text-transform: uppercase;
color: white;
/* height: 200px;
width: 200px; */
border-radius: 5px;
}
.front_cube, .right_cube, .top_cube {
background: red;
padding: 5px 5px;
display: flex;
justify-content: center;
align-items: center;
transform: perspective(400px) rotateY(45deg);
transition: all ease-in-out .2s;
}
.front_cube:hover, .right_cube:hover, .top_cube:hover{
transform: perspective(400px) rotateY(0deg);
/* box-shadow: 0 2px 2px rgba(0, 0, 0, 0.5); */
/* background: black; */
background: white;
color: black;
cursor: pointer;
}
.back_cube, .left_cube, .bottom_cube {
background: red;
padding: 5px 5px;
display: flex;
justify-content: center;
align-items: center;
transform: perspective(400px) rotateY(-45deg);
transition: all ease-in-out .2s;
}
.back_cube:hover, .left_cube:hover, .bottom_cube:hover{
transform: perspective(400px) rotateY(0deg);
/* box-shadow: 0 2px 2px rgba(0, 0, 0, 0.5); */
/* background: black; */
background: white;
color: black;
cursor: pointer;
}