我正在尝试制作div闪光灯,但我不希望它内部的文字闪烁,只是按钮本身.我不知道怎么能解决这个问题.我希望这有意义任何人都可以帮忙吗? 这是代码: @-moz-keyframes blink {0%{opacity:1;} 5
这是代码:
@-moz-keyframes blink {0%{opacity:1;} 50%{opacity:0.5;} 100%{opacity:1;}} /* Firefox */ @-webkit-keyframes blink {0%{opacity:1;} 50%{opacity:0.5;} 100%{opacity:1;}} /* Webkit */ @-ms-keyframes blink {0%{opacity:1;} 50%{opacity:0.5;} 100%{opacity:1;}} /* IE */ @keyframes blink {0%{opacity:1;} 50%{opacity:0.5;} 100%{opacity:1;}} /* Opera */ .download { background-color: red; padding: 15px 15px 15px 15px; text-align:center; margin-bottom: 4px; font-size: 24px; border-radius: 5px; -moz-transition:all 0.5s ease-in-out; -webkit-transition:all 0.5s ease-in-out; -o-transition:all 0.5s ease-in-out; -ms-transition:all 0.5s ease-in-out; transition:all 0.5s ease-in-out; -moz-animation:blink normal 1.5s infinite ease-in-out; /* Firefox */ -webkit-animation:blink normal 1.5s infinite ease-in-out; /* Webkit */ -ms-animation:blink normal 1.5s infinite ease-in-out; /* IE */ animation:blink normal 1.5s infinite ease-in-out; /* Opera */ }
<div class="download">DOWNLOAD TRIAL</div>JSfiddle Demo
不透明度会影响div及其所有孩子.我怀疑你需要的是带有alpha(透明度)组件的背景颜色.所以…在背景上使用RGBA颜色
@keyframes blink { 0% { rgba(255,0,0,1) } 50% { rgba(255,0,0,0.5) } 100% { rgba(255,0,0,1) } }