html+css好玩的案例
案例一
小块爬坡的的loading页面
效果图
css
*{
margin: 0;
padding: 0;
}
body{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #333;
}
.cbody{
display: flex;
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
transform: rotate(-60deg);
}
.content{
display: flex;
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
-webkit-box-reflect: below 10px -webkit-linear-gradient(transparent,transparent 50%,rgba(255,255,255,0.6));
animation: donghua1 1.5s ease-in-out infinite;
}
@keyframes donghua1 {
0%{
transform:translateX(0);
}
100%{
transform:translateX(-200px);
}
}
.cure{
width: 200px;
height: 200px;
background-color: rgb(7, 198, 246);
box-shadow: 0 0 5px 5px rgb(24, 178, 216),
0 0 30px 15px rgba(26, 177, 214,0.5),
0 0 40px 25px rgba(26, 177, 214,0.5);
animation: donghua 1.5s ease-in-out infinite;
transform-origin: bottom right;
}
@keyframes donghua {
0%{
transform:rotate(0);
}
60%{
transform:rotate(90deg);
}
60%{
transform:rotate(85deg);
}
60%{
transform:rotate(90deg);
}
75%{
transform:rotate(87.5deg);
}
80%,100%{
transform: rotate(90deg);
}
}
html
<!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">
<title>loading</title>
<link rel="stylesheet" href="./index.css">
</head>
<body>
<div class="cbody">
<div class="content">
<div class="cure"></div>
</div>
</div>
</body>
</html>
案例二
**
一个在三维下转动的环
**
css
*{
margin: 0;
padding: 0;
}
body{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #333;
transform-style: preserve-3d;
}
.content{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 500px;
perspective: 900px;
-webkit-box-reflect: below 10px -webkit-linear-gradient(transparent,transparent 50%,rgba(255,255,255,0.6));
/* //让总容器转动起来 */
/* animation: animation 5s linear infinite; */
}
/* @keyframes animation{
0%{
transform: rotateY(0);
filter: hue-rotate(0);
}
100%{
transform: rotateY(360deg);
filter: hue-rotate(360deg);
}
} */
span{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
border-radius: 50%;
border: 5px solid rgb(175, 51, 51);
box-shadow: 0 0 5px rgb(175, 51, 51),
0 0 25px rgba(175, 51, 51,.5);
/* //让小圈圈转动起来 */
animation: animation1 3s ease-in-out infinite;
}
@keyframes animation1{
0%{
transform: rotateY(0);
filter: hue-rotate(0);
}
100%{
transform: rotateY(360deg);
filter: hue-rotate(360deg);
}
}
span:nth-child(1){
width: 50px;
animation-delay: 0.1s;
}
span:nth-child(2){
width: 100px;
animation-delay: 0.2s;
}
span:nth-child(3){
width: 150px;
animation-delay: 0.3s;
}
span:nth-child(4){
width: 200px;
animation-delay: 0.4s;
}
span:nth-child(5){
width: 250px;
animation-delay: 0.5s;
}
span:nth-child(6){
width: 300px;
animation-delay: 0.6s;
}
span:nth-child(7){
width: 350px;
animation-delay: 0.7s;
}
span:nth-child(8){
width: 450px;
animation-delay: 0.8s;
}
span:nth-child(9){
width: 750px;
animation-delay: 0.9s;
}
span:nth-child(10){
width: 950px;
animation-delay: 1s;
}
span:nth-child(11){
width: 1250px;
animation-delay: 1.1s;
}
html
<!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">
<title>Document</title>
<link rel="stylesh