I was doing a 100 days css challenge and my z-index is not working (I want the shoe on the top of floor when they overlap).
<div class="frame">
<div class="invisible-men">
<div class="leg left">
<div class="shoe"></div>
</div>
<div class="leg right">
<div class="shoe"></div>
</div>
</div>
<div class="floor"></div>
</div>
.frame{
position:absolute;
width:400px;
height:400px;
background:rgb(246,232,215);
top:50%;
left:50%;
margin-top:-200px;
margin-left:-200px;
border-radius:2px;
box-shadow:0 0 13px 0 rgba(0,0,0,0.3);
overflow:hidden;
}
.floor {
position:absolute;
bottom:0px;
left:0px;
right:0px;
top:235px;
background:#232323;
z-index:1;
}
.invisible-men {
animation: fade-in .8s ease-out 1s;
animation-fill-mode: both;
z-index:2;
}
.leg {
position: absolute;
top: 0px;
left: 147px;
width: 151px;
height: 245px;
transform-origin:50% 0;
z-index:2;
}
.shoe {
position: absolute;
width: 151px;
height: 128px;
left: 0;
bottom: 0;
background: url('http://100dayscss.com/codepen/doc-martens.svg');
transform-origin: 0 95%;
z-index:2;
}
.left {
animation:leg 2s ease-in-out infinite;
}
.right {
animation: leg 2s ease-in-out 1s infinite;
}
.left .shoe {
animation:shoe 2s ease-in-out infinite;
}
.right .shoe {
animation:shoe 2s ease-in-out 1s infinite;
}
@keyframes leg {
0%, 100% {
tranform:rotate(0deg) translateX(-10px);
}
50% {
transform: translateY(-15px) translateX(30px);
}
}
@keyframes shoe {
0%, 100% {
transform:rotate(0deg)
}
25% {
transform: rotate(-15deg) translateY(0px) translateX(0);
}
75% {
transform: rotate(3deg) translateY(-7.5px) translateX(30px);
}
}
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
Please help me out, Thanks!
Edit: This is my pen https://codepen.io/ethn96/pen/MRdJbL