html+css好玩的案例(源码-纯手写)

本文展示了多个使用HTML和CSS创作的创意案例,包括3D空间文字、线条环绕动画、灯光效果导航等。通过源码分享,读者可以学习到如何实现这些有趣的视觉效果。


案例一



小块爬坡的的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
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值