纯css布局实现一辆跑车效果
代码语言:html
所属分类:布局界面
代码描述:纯css布局实现一辆跑车效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #002233;
margin: 0;
overflow: hidden;
}
:root {
--car-height: 10vh;
--gradient-size: 40px;
--shine-width: calc(var(--gradient-size) + 5px);
--shine-height: 80%;
--color: #8c0000;
--color2: rgba(221,221,221,1);
animation: shine 0.5s linear infinite;
}
ul {
list-style-type: none;
}
#car-container {
height: calc(var(--car-height) * 3);
display: flex;
justify-content: flex-start;
align-items: center;
}
#center-lines-container {
width: calc(var(--car-height) * 6);
height: 1%;
position: absolute;
left: calc(var(--car-height) * -2.2);
top: 50%;
display: flex;
justify-content: space-between;
z-index: 5;
padding: 0;
}
.center-line {
height: 100%;
background-color: white;
filter: drop-shadow(0px -2px 1px rgba(0, 0, 0, 0.6));
}
#center-line1 {
width: calc(var(--car-height) * 1.2);
border-radius: 50%;
}
#center-line2 {
width: calc(var(--car-height) * 2.6);
border-radius: 85% 15% 10% 90% / 0% 0% 100% 100%;
}
.car-front {
width: calc(var(--car-height) * 3);
height: 100%;
background-color: var(--color);
border-radius: 30% 70% 70% 30% / 50% 5% 5% 50%;
box-shadow: inset 41px 0 20px -6px rgba(0, 0, 0, 0.74), inset -38px 31px 34px 9px rgba(255, 255, 255, 0.25), inset -28px -42px 20px -6px rgba(255, 255, 255, 0.6);
}
.car-center {
width: calc(var(--car-heigh.........完整代码请登录后点击上方下载按钮下载查看
网友评论0