Project Introduction: In this project, we are going to implement a car running on a track using HTML and CSS with sound effects
File structure:
- . index.html
- . style.css
- .css/all.css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="css/all.css">
<title>Neumorphism Animation </title>
</head>
<body>
<div class="animtion">
<div style="--i:0"></div>
<div style="--i:1"></div>
<div style="--i:2"></div>
<div style="--i:3"></div>
<div style="--i:4"></div>
</div>
</body>
style.css: The following is the code for file “style.css” which is used in the above HTML code.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
background: #11e6b0;
min-height: 100vh;
}
.animtion {
display: flex;
flex-direction: row;
}
.animtion div {
position: relative;
width: 40px;
height: 200px;
margin: 20px;
border-radius: 40px;
overflow: hidden;
border: 2px solid #11e6b0;
background: linear-gradient(0, 0, 0, 0.5, #11e6b0);
box-shadow: 15px 15px 20px #0000001a, -15px -15px 20px #11e6b0, inset -5px 5px 5px #08eedb80, inset 5px 5px 5px #0000001a;
}
.animtion div::before {
content: '';
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 40px;
box-shadow: 15px 15px 20px #0000001a, -15px -15px 20px #11e6b0, inset -5px 5px 5px #08eedb80, inset 5px 5px 5px #0000001a;
;
}
.animtion div::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 36px;
height: 36px;
background: #fff;
border-radius: 40px;
box-shadow: inset -5px -5px 5px #00000033, 0 420px 0 400px #2196f3;
animation: animate 2.5s ease-in-out infinite;
animation-delay: calc(0.5s * var(--i));
}
@keyframes animate {
0% {
transform: translateY(160px);
filter: hue-rotate(180deg);
}
50% {
transform: translateY(0px);
}
100% {
transform: translateY(160px);
filter: hue-rotate(0deg);
}
}
0 Comments