纯css+div实现年份是否闰年计算代码
代码语言:html
所属分类:其他
代码描述:纯css+div实现年份是否闰年计算代码,无js代码,纯粹css和div实现。
代码标签: 纯 css div 年份 是否 闰年 计算 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Nabla&display=swap'>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
--display-height: 160px;
--arrow-height: 30px;
height: 100vh;
background: linear-gradient(160deg, #555 0%, #222 100%);
}
.leap-year {
position: relative;
user-select: none;
-webkit-user-select: none;
}
.cb {
position: absolute;
top: calc(50vh - 50px - var(--display-height) / 2 - var(--arrow-height));
z-index: 100;
display: none;
width: 100px;
height: var(--arrow-height);
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
cursor: pointer;
}
.cb:checked {
top: calc(50vh - 50px + var(--display-height) / 2);
}
.cb.n-0, .cb:checked + .cb {
display: block;
}
.cb.closer {
display: none !important;
}
.up,
.down {
position: absolute;
z-index: 100;
width: 100px;
height: var(--arrow-height);
opacity: 1;
background: gold;
transition: opacity 100ms linear;
pointer-events: none;
}
.up {
top: calc(50vh - 50px - var(--display-height) / 2 - var(--arrow-height));
clip-path: polygon(40% 70%, 60% 70%, 50% 30%);
}
.down {
top: calc(50vh - 50px + var(--display-height) / 2);
clip-path: polygon(40% 30%, 60% 30%, 50% 70%);
}
.th-0:not(:checked) ~ .arrows .down.th,
.th-8:checked ~ .arrows .up.th,
.h-0:not(:checked) ~ .arrows .down.h,
.h-8:checked ~ .arrows .up.h,
.t-0:not(:checked) ~ .arrows .down.t,
.t-8:checked ~ .arrows .up.t,
.o-0:not(:checked) ~ .arrows .down.o,
.o-8:checked ~ .arrows .up.o {
opacity: 0.3;
}
.display {
--numbers: "0 \a 1 \a 2 \a 3 \a 4 \a 5 \a 6 \a 7 \a 8 \a 9";
--number: 0;
position: absolute;
top: calc(50vh - 50px - var(--display-height) / 2);
z-index: 200;
display: flex;
overflow: hidden;
width: 100px;
height: var(--display-height);
border-right: 4px solid #999;
border-left: 4px solid #666;
border-top: 2px solid #666;
border-bottom: 2px solid #999;
justify-content: center;
align-items: center;
background: linear-gradient(to bottom, #777 0%, #333 100%);
color: gold;
font-family: sans-serif;
font-size: 140px;
font-weight: 900;
line-height: var(--display-height);
text-align: center;
text-shadow: 1px 1px 2px #777, -1px -1px 2px #333;
}
.display::before {
--shift: calc(var(--number) * (var(--display-height) * -1));
position: absolute;
top: 0;
left: 0;
font-size: inherit;
line-height: inherit;
transform: translate3d(0, var(--shift), 0);
transition: transform 300ms cubic-bezier(0.6, 0, 0.6, 1.5);
content: var(--numbers);
}
.display::after {
position: absolute;
top: 0;
left: 0;
z-index: 1;
display: block;
width: 100%;
height: 100%;
box-shadow: inset 0 -8px 8px rgba(0, 0, 0, 0.8), inset 0 8px 8px rgba(0, 0, 0, 0.8);
content: "";
}
.th-0:checked ~ .display-th,
.h-0:checked ~ .display-h,
.t-0:checked ~ .display-t,
.o-0:checked ~ .display-o {
--number: 1;
}
.th-1:checked ~ .display-th,
.h-1:checked ~ .display-h,
.t-1:checked ~ .display-t,
.o-1:checked ~ .display-o {
--number: 2;
}
.th-2:checked ~ .display-th,
.h-2:checked ~ .display-h,
.t-2:checked ~ .display-t,
.o-2:checked ~ .display-o {
--number: 3;
}
.th-3:checked ~ .display-th,
.h-3:checked ~ .display-h,
.t-3:checked ~ .display-t,
.o-3:checked ~ .display-o {
--number: 4;
}
.th-4:checked ~ .display-th,
.h-4:checked ~ .display-h,
.t-4:checked ~ .display-t,
.o-4:checked ~ .display-o {
--number: 5;
}
.th-5:checked ~ .display-th,
.h-5:checked ~ .display-h,
.t-5:checked ~ .display-t,
.o-5:checked ~ .display-o {
--number: 6;
}
.th-6:checked ~ .display-th,
.h-6:checked ~ .display-h,
.t-6:checked ~ .display-t,
.o-6:checked ~ .display-o {
--number: 7;
}
.th-7:checked ~ .display-th,
.h-7:checked ~ .display-h,
.t-7:checked ~ .display-t,
.o-7:checked ~ .display-o {
--number: 8;
}
.th-8:checked ~ .display-th,
.h-8:checked ~ .........完整代码请登录后点击上方下载按钮下载查看
网友评论0