前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CSS 3.0实现会发光的卡片

CSS 3.0实现会发光的卡片

作者头像
越陌度阡
发布2020-11-26 10:32:02
6240
发布2020-11-26 10:32:02
举报

给大家分享一个用CSS 3.0实现的会发光的卡片特效,效果如下:

以下是代码实现,欢迎大家复制粘贴和收藏。

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>CSS 3.0实现会发光的卡片</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            font-family: '微软雅黑', sans-serif;
        }

        body {
            display: flex;
            align-items: center;
            justify-content: center;
            background: #010615;
            min-height: 100vh;
            flex-wrap: wrap;
        }

        .box {
            position: relative;
            width: 300px;
            height: 400px;
            display: flex;
            justify-content: center;
            align-items: center;
            background: #060c21;
            margin: 60px 40px;
        }

        .box::before {
            content: '';
            position: absolute;
            top: -2px;
            left: -2px;
            right: -2px;
            bottom: -2px;
            background: #fff;
            z-index: -1;
        }

        .box::after {
            content: '';
            position: absolute;
            top: -2px;
            left: -2px;
            right: -2px;
            bottom: -2px;
            background: #fff;
            filter: blur(40px);
            z-index: -2;
        }

        .box:nth-child(1)::before,
        .box:nth-child(1)::after {
            background: linear-gradient(235deg, #89ff00, #010615, #00bcd4);
        }

        .box:nth-child(2)::before,
        .box:nth-child(2)::after {
            background: linear-gradient(235deg, #ff005e, #010615, #fbff00);
        }

        .box:nth-child(3)::before,
        .box:nth-child(3)::after {
            background: linear-gradient(235deg, #772aff, #010615, #2196f3);
        }


        .box .glass {
            position: absolute;
            top: 0;
            left: 0;
            width: 50%;
            height: 100%;
            display: block;
            background: rgba(255, 255, 255, .1);
        }

        .box .content {
            padding: 20px;
            color: #fff;
            line-height: 2;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="glass"></div>
        <div class="content">
            <h2>我是发光的边框</h2>
            <p>
                任何时候,无论你面临着生命的何等困惑,抑或经受着多少挫折,无论道路如何的艰难,无论希望变得如何渺茫,请你不要绝望,再试一次,成功一定属于你!
                任何时候,无论你面临着生命的何等困惑,抑或经受着多少挫折,无论道路如何的艰难,无论希望变得如何渺茫,请你不要绝望,再试一次,成功一定属于你!
            </p>
        </div>
    </div>
    <div class="box">
        <div class="glass"></div>
        <div class="content">
            <h2>我是发光的边框</h2>
            <p>
                任何时候,无论你面临着生命的何等困惑,抑或经受着多少挫折,无论道路如何的艰难,无论希望变得如何渺茫,请你不要绝望,再试一次,成功一定属于你!
                任何时候,无论你面临着生命的何等困惑,抑或经受着多少挫折,无论道路如何的艰难,无论希望变得如何渺茫,请你不要绝望,再试一次,成功一定属于你!
            </p>
        </div>
    </div>
    <div class="box">
        <div class="glass"></div>
        <div class="content">
            <h2>我是发光的边框</h2>
            <p>
                任何时候,无论你面临着生命的何等困惑,抑或经受着多少挫折,无论道路如何的艰难,无论希望变得如何渺茫,请你不要绝望,再试一次,成功一定属于你!
                任何时候,无论你面临着生命的何等困惑,抑或经受着多少挫折,无论道路如何的艰难,无论希望变得如何渺茫,请你不要绝望,再试一次,成功一定属于你!
            </p>
        </div>
    </div>
</body>

</html>
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020/06/02 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档