• 欢迎访问爱TY网,欢迎加入爱TY网 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏爱TY网吧

利用:before选择器给你的网站Logo添加扫光特效

网站相关 TY 来源:boke112 6年前 (2017-11-06) 2755次浏览 已收录 0个评论 扫描二维码

Logo扫光方法

方法很简单,只需要添加一段css代码即可,如果你是WordPress程序,那么请在当前主题css文件最下方添加如下代码,需注意:代码中的#logo:before,根据自己的实际情况修改为当前主题的Logo元素选择器名称。

/**logo扫光效果CSS**/
#logo:before{
    content:“”;
    position: absolute;
    left: –665px;
    top: –460px;
    width: 200px;
    height: 15px;
    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 1s 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; }
}

当然,此效果也适用于其他建站程序,其仅仅是一个CSS效果而已。

:before 选择器介绍

  • :before 选择器在被选元素的内容前面插入内容。
  • 请使用 content 属性来指定要插入的内容。
  • 所有主流浏览器都支持:before选择器。
  • 注意: before在IE8中运行,必须声明 <!DOCTYPE> 。

爱TY网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:利用:before选择器给你的网站Logo添加扫光特效
喜欢 (1)
[nyqty@qq.com]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址