如何通过css样式来实现网站logo发光动画效果

html-css025

如何通过css样式来实现网站logo发光动画效果,第1张

添加修改CSS代码如下 :

.logo-site,.logo-sites{position:relativefloat:leftmargin:18px 0 0 10pxwidth:220pxmax-height:50pxoverflow:hiddentransition-duration:.5s}

.logo-site img,.logo-sites img{width:220pxmax-height:50px}@media screen and (max-width:480px){

.logo-site,.logo-sites{width:140px}}@media screen and (min-width:900px){

.logo-site:before{content:""position:absoluteleft:-665pxtop:-460pxwidth:220pxheight:15pxbackground-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 infiniteanimation:searchLights 1s ease-in 1s infinite}}@-webkit-keyframes searchLights{0%{left:-100pxtop:0}to{left:120pxtop:100px}}@-o-keyframes searchLights{0%{left:-100pxtop:0}to{left:120pxtop:100px}}@-moz-keyframes searchLights{0%{left:-100pxtop:0}to{left:120pxtop:100px}}@keyframes searchLights{0%{left:-100pxtop:0}to{left:120pxtop:100px}}

.site-title{font-size:24pxfont-size:2.4remfont-weight:700padding:0 0 2px 0}

.site-name{display:none}@media screen and (min-width:900px){

.logo-site img,.logo-sites img{transition-duration:.8s}

操作流程

把css代码当中的logo-site改成你网站包围logo的css即可(f12键审核元素,即可找到你的logo的css元素)。找到你logo的css名称然后把上面的css代码修改成你的css名称,放入css代码当中即可(防止出错,记得备份!)

以上就是logo添加css扫光效果的方法,当然你也可以运用到其他的地方。

注意,有些模板CSS代码不相同,不能贸然的使用,可能会出现错误,新手不要尝试。

<!DOCTYPE html>

<html>

<head> 

<meta charset="utf-8"> 

<title>CSS3发光字</title> 

<style>

*{ padding:0margin:0font-size:14px }

body{ background: #f3f5f5 }

.d{ width:100%text-align:centermargin:20px auto }

.a , .n{ text-decoration: nonefont-size:6emfont-family:"微软雅黑" }

.a{ color:blue }

.a:link{ color:blue }

.n{ color:#FFFtext-shadow: 0 0 10px #000,0 0 25px #000 }

.def , .h:hover{ animation: run 2.4s infinite-webkit-animation: run 2.4s infinite-moz-animation: run 2.4s infinite

-ms-animation: run 2.4s infinite-o-animation: run 2.4s infinite }

@-webkit-keyframes run{

0%,100%{ color:#ffftext-shadow:0 0 10px blue,0 0 10px blue }

50%{ text-shadow:0 0 10px blue,0 0 40px blue }

}

@-moz-keyframes run{

0%,100%{ color:#ffftext-shadow:0 0 10px blue,0 0 10px blue }

50%{ text-shadow:0 0 10px blue,0 0 40px blue }

}

@-o-keyframes run{

0%,100%{ color:#ffftext-shadow:0 0 10px blue,0 0 10px blue }

50%{ text-shadow:0 0 10px blue,0 0 40px blue }

}

@-ms-keyframes run{

0%,100%{ color:#ffftext-shadow:0 0 10px blue,0 0 10px blue }

50%{ text-shadow:0 0 10px blue,0 0 40px blue }

}

@keyframes run{

0%,100%{ color:#ffftext-shadow:0 0 10px blue,0 0 10px blue }

50%{ text-shadow:0 0 10px blue,0 0 40px blue }

}

</style>

</head>

<body>

<hr>

字体不带动效:

<div class="d">

<a href="javascript:void(0)" class="n">如何使用CSS3制作特效发光字</a>

</div>

<hr>

字体自带动效:

<div class="d">

<a href="javascript:void(0)" class="a def">不记得你的名字,但记得你的死期。</a>

</div>

<hr>

字体悬浮动效:

<div class="d">

<a href="javascript:void(0)" class="a h">剑之所至,心之所往。</a>

</div>

<hr>

</body>

</html>

在样式表中,定义一个

img

{filter:none}

这样,页面中的所有图片就不会有发光效果了!

把body的stlye属性删除掉,再把你要发光的字体加入到一个DIV