JSFiddle - React, Tailwind, and code Playground
by MD Hasan Patwary
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Human Figure</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="human">
<div class="head"></div>
<div class="body">
<div class="left-arm"></div>
<div class="right-arm"></div>
</div>
<div class="legs">
<div class="left-leg"></div>
<div class="right-leg"></div>
</div>
</div>
</body>
</html>
CSS
body {
background-color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.human {
width: 120px;
height: 300px;
position: relative;
animation: walk 1s infinite alternate;
}
.head {
width: 80px;
height: 80px;
background-color: #e0ac69;
border-radius: 50%;
position: absolute;
top: 0;
left: 20px;
}
.body {
width: 80px;
height: 180px;
background-color: #e0ac69;
position: absolute;
top: 80px;
left: 20px;
}
.left-arm, .right-arm {
width: 20px;
height: 100px;
background-color: #e0ac69;
position: absolute;
top: 20px;
}
.left-arm {
transform: rotate(45deg);
left: -20px;
}
.right-arm {
transform: rotate(-45deg);
right: -20px;
}
.legs {
width: 80px;
height: 120px;
position: absolute;
top: 260px;
left: 20px;
}
.left-leg, .right-leg {
width: 20px;
height: 100px;
background-color: #e0ac69;
position: absolute;
bottom: 0;
animation: leg-move 1s infinite alternate;
}
.left-leg {
left: 20px;
}
.right-leg {
right: 20px;
}
@keyframes walk {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-5px);
}
}
@keyframes leg-move {
0% {
transform: rotate(0);
}
50% {
transform: rotate(20deg);
}
100% {
transform: rotate(0);
}
}