• 微信号:Zh-y9213
您当前的位置:爱资源分享网 > > 网站源码 > 教程合集

为博客logo添加一个扫光的特效

栏目:教程合集时间:2022-07-11 13:50阅读数:95人阅读

经常能在别人的个人博客头部logo上看到一个扫光的特效,比如张戈博客:

觉得这个小细节虽然用处不大,但是对于美化博客还是不错的,余斗最近抽空把这个特效也研究了一下,成功在自己的博客logo处使用,大家可以看看效果,接下来就把这个特效的实现方法写出来,希望能帮到大家。

这个特效大部分都应用在WordPress博客中,如过你用的是WordPress,那么可以在当前使用主题的css文件中添加代码,如果是非WordPress,那么道理也相同,把代码加入到相关的css文件即可。


       
        #logo:before{
                content:"";
                position: absolute;
                left: -665px;
                top: -460px;
                width: 200px;
                height: 10px;
                background-color: rgba(255,255,255,.5);
                -webkit-transform: rotate(-45deg);
                -moz-transform: rotate(-45deg);
                -ms-transform: rotate(-45deg);
                -o-transform: rotate(-45deg);
                transform: rotate(-45deg);
                -webkit-animation: searchLights 1s ease-in 1s infinite;
                -o-animation: searchLights 1s ease-in 1s infinite;
                animation: searchLights 1.5s ease-in 1s infinite;
        }
        @-webkit-keyframes searchLights {
                0% { left: -100px; top: 0; }
                to { left: 120px; top: 100px; }
        }
        @-o-keyframes searchLights {
                0% { left: -100px; top: 0; }
                to { left: 120px; top: 100px; }
        }
        @-moz-keyframes searchLights {
                0% { left: -100px; top: 0; }
                to { left: 120px; top: 100px; }
        }
        @keyframes searchLights {
                0% { left: -100px; top: 0; }
                to { left: 120px; top: 100px; }
        }

代码释义:

1、代码中的#logo:before,根据自己的实际情况修改为当前主题的Logo元素选择器名称。

2、:before 选择器在被选元素的内容前面插入内容。

3、注意要请使用 content 属性来指定要插入的内容。

4、所有主流浏览器都支持:before选择器。 而:before在IE8中运行,必须声明 < !DOCTYPE> 。


资源均来自第三方,谨慎下载,前往第三方网站下载

本站所有文章、数据、图片均来自互联网,一切版权均归源网站或源作者所有。

如果侵犯了你的权益请来信告知我们删除。邮箱:737597453@qq.com