纯div+css实现翻书loading

效果图:

话不多说,直接上代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>纯css3实现翻书效果</title>
    <link href="reset.css" rel="stylesheet" type="text/css">
    <style>
        *{
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        .perspective {
            margin-top: 100px;
            perspective: 800px;
            transform-style: preserve-3d;
        }
        .book-wrap {
            width: 100px;
            height: 60px;
            position: relative;
            margin: 0 auto;
            transform: rotateX(30deg);
            transform-style: preserve-3d;
        }
        .page {
            position: absolute;
            top: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            border: 5px solid #bc3442;
            background-color: #bc3442;
            border-radius: 4%;
        }
        .book-cover-first{
            left: 0;
            width: 50%;
            height: 100%;
        }
        .book-cover-first .left-content{
            width: calc(100% + 5px);
            height: 100%;
            box-shadow: 0px 5px #FFCC99;
            position: absolute;
            top: -5px;
            left: 0px;
            border-radius: 4%;
            background-color: #FFF6D9;
        }
        .book-cover-first .left-content .page-item{
            width: 100%;
            height: 100%;
            background-color: #FFF6D9;
            border-radius: 4%;
            padding: 5px;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
        }
        .book-cover-end{
            right: 0;
            width: 50%;
            height: 100%;
        }
        .book-cover-end .right-content{
            width: calc(100% + 5px);
            height: 100%;
            box-shadow: 0px 5px #FFCC99;
            position: absolute;
            top: -5px;
            right: 0px;
            border-radius: 4%;
            background-color: #FFF6D9;
        }
        .book-cover-end .right-content .page-item{
            position: absolute;
            top: 0;
            right: 0;
            width: 100%;
            height: 100%;
            background-color: #FFF6D9;
            animation: roll 2s ease 0s infinite;
            transform-origin: left;
            border-radius: 4%;
            border: 1px solid #FFCC99;
            padding: 5px;
        }
        .book-cover-end .right-content .page-cover{
            position: absolute;
            top: 0;
            right: 0;
            width: 100%;
            height: 100%;
            background-color: #FFF6D9;
            border-radius: 4%;
            border: 1px solid #FFCC99;
            padding: 5px;
        }
        .page-line{
            height: 4px;
            border-radius: 2px;
            margin-bottom: 4px;
            background-color: #FFCC99;
        }

        @keyframes roll {
            from {transform: rotateY(0)}
            to {transform: rotateY(-180deg)}
        }
    </style>
</head>
<body>

<div class="perspective">
    <div class="book-wrap">
        <div class="page book-cover-first">
            <div class="left-content">
                <div class="page-item">
                    <div class="page-line" style="width: 100%;"></div>
                    <div class="page-line" style="width: 30%;"></div>
                    <div class="page-line" style="width: 70%;"></div>
                    <div class="page-line" style="width: 50%;"></div>
                    <div class="page-line" style="width: 10%;"></div>
                </div>
            </div>
        </div>
        <div class="page book-cover-end">
            <div class="right-content">
                <div class="page-item">
                    <div class="page-line" style="width: 100%;"></div>
                    <div class="page-line" style="width: 30%;"></div>
                    <div class="page-line" style="width: 70%;"></div>
                    <div class="page-line" style="width: 50%;"></div>
                    <div class="page-line" style="width: 10%;"></div>
                </div>
                <div class="page-cover">
                    <div class="page-line" style="width: 100%;"></div>
                    <div class="page-line" style="width: 30%;"></div>
                    <div class="page-line" style="width: 70%;"></div>
                    <div class="page-line" style="width: 50%;"></div>
                    <div class="page-line" style="width: 10%;"></div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

专业前端小白

写了这么久文章,1分钱都没收到

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值