html5 - 有没有纯CSS伪元素写的效果?
天蓬老师
天蓬老师 2017-04-17 11:56:56
[HTML讨论组]

有没有纯CSS伪元素写的效果? 之前在网上看到用纯CSS写成的样式,忘记收藏了,现在再也找不到了

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

全部回复(2)
怪我咯

刚受这个帖子启发画了个彩虹:
CSS

    .box {
        position: relative;
        width: 400px;
        height: 160px;
        overflow: hidden;
    }
    .box::before {
        display: block;
        width: 360px;
        height: 300px;
        margin: 60px auto 0;
        border-radius: 100%;
        border: solid 1px white;
        box-shadow: 0 -5px 5px green, 0 -10px 10px yellow, 0 -15px 15px red, 0 -20px 20px yellow, 0 -25px 20px blue;
        content: " ";
    }
    .box::after {
        position: absolute;
        left: 0;
        bottom: 0;
        width: 400px;
        height: 160px;
        background-image: -webkit-linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255,1));
        background-image: -o-linear-gradient(top, rgba(255,255,255,0), rgba(255,255,255,1));
        background-image: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
        background-repeat: repeat-x;
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='', endColorstr='#ffffff', GradientType=0);
        content: " ";
    }

html

<p class="box"></p>

效果

PHP中文网

刚在慕课网上学了用伪元素写的box—shadow效果,可以去慕课网搜一下box–shadow那个视频

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号