旋转展示效果css3-倒影效果

本文介绍了如何利用CSS3技术创建旋转展示及倒影效果,详细讲解了相关代码实现过程,并提供了代码示例资源链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

 

*{
    margin: 0;
    padding: 0;
}
body{
    width: 100%;
    height: 100vh;
    background-color: black;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    perspective: 900px;
}
section{
    position: relative;
    width: 300px;
    height: 200px;
    transform-style: preserve-3d;
    animation: animation 20s linear infinite;
}
img{
    width: 200px;
    height:150px ;
    margin-top: 30px;
}
section div{
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top:0;
    line-height: 200px;
    text-align: center;
    -webkit-box-reflect: below 15px -webkit-linear-gradient(transparent 10%, rgba(255, 255, 255, 0.3));
}
section div:nth-child(1){
    background-color: rgb(249, 217, 167);
    transform:translateZ(300px) ;
}
section div:nth-child(2){
    background-color: rgb(251, 185, 80);
    transform: rotateY(60deg) translateZ(300px) ;
}
section div:nth-child(3){
    background-color: rgb(134, 83, 1);
    transform: rotateY(120deg) translateZ(300px) ;
}
section div:nth-child(4){
    background-color: rgb(255, 158, 2);
    transform: rotateY(180deg) translateZ(300px) ;
}
section div:nth-child(5){
    background-color: rgb(156, 110, 37);
    transform: rotateY(240deg) translateZ(300px) ;
}
section div:nth-child(6){
    background-color: rgb(63, 39, 1);
    transform: rotateY(300deg) translateZ(300px) ;
}
@keyframes animation {
    0%{
        transform: rotateY(0);
    }
    100%{
        transform: rotateY(360deg);
    }
}

<!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="stylesheet" href="./css/index.css">
</head>
<body>
    <section>
        <div><img src="./img/1.png" alt=""></div>
        <div><img src="./img/2.png" alt=""></div>
        <div><img src="./img/3.png" alt=""></div>
        <div><img src="./img/4.png" alt=""></div>
        <div><img src="./img/5.png" alt=""></div>
        <div><img src="./img/6.png" alt=""></div>
    </section>
</body>
</html>

望舒/css-age (gitee.com)https://gitee.com/wang-dd123/css-age

 代码地址

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值