CSS玻璃卡片悬停效果

没有代码效果展示

CSS玻璃卡片悬停效果

代码展示:

HTML:

<body>
    <div class="container">
        <div class="card">
            <div class="content">
                <h2>01</h2>
                <h3></h3>
                <p>愿幸福、快乐如影随行,永远伴随您;愿进取、成功如日东升,永远激励您</p>
                <a href="">read More</a>
            </div>
        </div>
        <div class="card">
            <div class="content">
                <h2>02</h2>
                <h3></h3>
                <p>真理无所谓时效。即使隔得再久,也不会因此而变</p>
                <a href="">read More</a>
            </div>
        </div>
        <div class="card">
            <div class="content">
                <h2>03</h2>
                <h3></h3>
                <p>上一个目标那是你下一个目标的基础,下一个目标就是上一个目标的延续。</p>
                <a href="">read More</a>
            </div>
        </div>
    </div>
</body>

css:

* {
    border: 0;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body{
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: black;
}

body::before{
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(#2193b0, #6dd5ed);
    clip-path: circle(30% at right 70%);
}

body::after{
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(#ee9ca7, #ffdde1);
    clip-path: circle(20% at 10% 10%);
}

.container{
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    z-index: 1;
}

.container .card{
    position: relative;
    width: 280px;
    height: 400px;
    background-color: rgba(255, 255, 255, .1);
    margin: 30px;
    border-radius: 15px;
    box-shadow: 20px 20px 50px rgba(0, 0, 0, .5);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, .5);
    border-left: 1px solid rgba(255, 255, 255, .5);
    backdrop-filter: bler(5px);
}

.container .card .content{
    padding: 20px;
    text-align: center;
    transform: translateY(100px);
    opacity: 0;
    transition: .5s;
}

.container .card:hover .content{
    transform: translateY(0);
    opacity: 1;
}

.container .card .content h2{
    position: absolute;
    top: -80px;
    right: 25px;
    font-size: 128px;
    color: rgba(255, 255, 255, .05);
}
.container .card .content h3{
    font-size: 28px;
    color: #fff;
}
.container .card .content p{
    font-size: 16px;
    color: #fff;
    font-weight: 300;
    margin: 10px - 15px 0;
}
.container .card .content a{
    position: relative;
    display: inline-block;
    padding: 8px 20px;
    margin-top: 15px;
    background-color: #fff;
    color: #000;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0, 0, 0, .2);
}

JavaScript:

<script src="https://cdn.bootcdn.net/ajax/libs/vanilla-tilt/1.7.2/vanilla-tilt.js"></script>
<script>
        VanillaTilt.init(document.querySelectorAll(".card"),{
            max: 15,
            speed: 400,
            glare: true,
            "max-glare": 1
        })
    </script>
© 版权声明
THE END
喜欢就支持一下吧
点赞650赞赏 分享
评论 共4条

请登录后发表评论