.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>无标题文档</title>
<style type="text/css">
*{padding:0margin:0border:0}
.left{width:50%float:left
animation:myfirst 5s
-moz-animation:myfirst 5s/* Firefox */
-webkit-animation:myfirst 5s/* Safari and Chrome */
-o-animation:myfirst 5s/* Opera */
}
.right{width:50%float:left
animation:myfirst 5s
-moz-animation:myfirst 5s/* Firefox */
-webkit-animation:myfirst 5s/* Safari and Chrome */
-o-animation:myfirst 5s/* Opera */
animation-delay: 5s/* W3C 和 Opera */
-moz-animation-delay: 5s/* Firefox */
-webkit-animation-delay: 5s/* Safari 和 Chrome */
}
@keyframes myfirst
{
0% { opacity:0}
100% { opacity:1}
}
@-moz-keyframes myfirst /* Firefox */
{
0% { opacity:0}
100% { opacity:1}
}
@-webkit-keyframes myfirst /* Safari 和 Chrome */
{
0% { opacity:0}
100% { opacity:1}
}
@-o-keyframes myfirst /* Opera */
{
0% { opacity:0}
100% { opacity:1}
}
</style>
</head>
<body>
<div>
<div class="left"><img src="images/xxx.jpg"></div>
<div class="right">文字XXXXXXXXXXXXXXXXXXXXXXXX </div>
</div>
</body>
</html>
用jQuery轻松加愉快。
比如<img>有id="myImg",则写这样的jQuery代码:
function checkboxOnclick(checkbox){if ( checkbox.checked == false){ // 写反了……╮(╯-╰)╭
$("#myImg").css("max-width", "") // 给元素去掉css
}
else{
$("#myImg").css("max-width", "100%") // 给元素加上css
}
}