温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

CSS实现3D书本效果代码

发布时间:2021-03-18 11:22:56 来源:亿速云 阅读:136 作者:小新 栏目:web开发

这篇文章主要介绍了CSS实现3D书本效果代码,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

话不多说,先来看一下效果图

CSS实现3D书本效果代码

源代码如下

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    *{
        margin: 0;
        padding: 0;
    }
    body{
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 100vh;
        background: #333333;
        background-size: cover;
    }
    .book{
        width: 400px;
        height: 600px;
        position: relative;
        background-color: #ffffff;
        transform: rotate(-37.5deg) skewX(10deg);
        box-shadow: -35px 35px 50px rgb(0,0, 0, 1);
        transition: 0.5s;
        /* 光标呈现为指示链接的指针(一只手) */
        cursor: pointer;
    }
    .book:hover{
        /* rotate 定义 2D 旋转,在参数中规定角度。 */
        /* skewX()定义沿着 X 轴的 2D 倾斜转换。
            translate(x,y) 定义 2D 转换。
          */
        transform: rotate(-37.5deg) skewX(10deg) translate(20px,-20px);
        /* box-shadow 向框添加一个或多个阴影 */
        box-shadow: -50px 50px 100px rgba(0,0,0,1);
    }
    /* 伪元素必须配合content进行使用,至少为空 */
    .book::before{
        content:'';
        height:100%;
        width:30px;
        background: red;
        position: absolute;
        top: 0;
        left: 0;
        transform: skewY(-45deg) translate(-30px,-15px); 
        box-shadow: inset -10px 0 20px raba(0,0,0,0,2);
        background: url(cofe.jpg);
    }
    .book::after{
            content: '';
            height: 30px;
            width: 100%;
            background: #fff;
            position: absolute;
            bottom: 0;
            left: 0;
            transform: skewX(-45deg) translate(15px,30px);
            background: url(cofe.jpg);

    }
    .book h3{
        position: absolute;
        bottom: 100px;
        left: 10px;
        font-size: 5em;
        line-height: 1em;
        color: rgb(110, 21, 21);
    }
    .book h3 span{
        background-image: url(cofe.jpg);
        background-attachment: fixed;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    .book .write i{
        font-weight: 700;
    }
    .book .cover{
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 70%;
        background-image: url(cofe.jpg);
        background-size: cover;
    }


</style>


<body>
    <div class="book">
        <div class="cover"></div>
        <h3>Book <span>javascript</span></h3>
        <span class="wirte"> written by fans</span>
    </div>
</body>
</html>

感谢你能够认真阅读完这篇文章,希望小编分享的“CSS实现3D书本效果代码”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI