css+div实现随机摇骰子出点数数字效果代码
代码语言:html
所属分类:其他
代码描述:css+div实现随机摇骰子出点数数字效果代码,无js代码,纯粹div+css代码实现。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #def;
}
input[type=radio] {
display: none;
}
.container {
background-color: #d07;
block-size: 50vmin;
border-radius: 5%;
box-shadow: 0 2.5vmin 2vmin -2vmin #000;
inline-size: 50vmin;
left: calc(50% - 25vmin);
overflow: hidden;
position: fixed;
top: calc(50% - 25vmin);
}
.dice {
block-size: 50%;
inline-size: 50%;
margin: 25%;
position: absolute;
}
.dice > .face {
align-items: center;
animation: roll 0.5s ease-out;
background-color: #fff;
block-size: 100%;
border-radius: 10%;
box-shadow: 0 1vmin 1vmin -1vmin #000;
display: none;
font-family: serif;
font-size: 20vmin;
inline-size: 100%;
justify-content: center;
position: absolute;
}
.dice > .help {
align-items: center;
block-size: 100%;
color: #fff;
display: flex;
font-family: system-ui;
font-size: 5vmin;
inline-size: 100%;
justify-content: center;
line-height: 1.1;
text-align: center;
}
.labels {
animation: loopX 6s steps(6) infinite;
block-size: 100%;
display: flex;
inline-size: 100%;
position: absolute;
}
.labels > label {
block-size: 100%;
cursor: pointer;
flex: 0 0 100%;
inline-size: 100%;
opacity: 0;
}
.reset {
block-size: 100%;
cursor: pointer;
display: none;
inline-size: 100%;
opacity: 0;
position: absolute;
}
@keyframes loopX {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-600%);
}
}
@keyframes roll {
0% {
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0