我真的希望能让一段文本以老式的方式闪烁,而不使用javascript或text-decoration.
没有过渡效果,只有*闪烁*,*闪烁*,*闪烁*!
这与那个问题不同,因为我要求闪烁而没有连续的过渡效果,而另一个问题的OP则询问如何用连续的过渡效果替换闪烁
我真的希望能让一段文本以老式的方式闪烁,而不使用javascript或text-decoration.
没有过渡效果,只有*闪烁*,*闪烁*,*闪烁*!
这与那个问题不同,因为我要求闪烁而没有连续的过渡效果,而另一个问题的OP则询问如何用连续的过渡效果替换闪烁
最初的Netscape <blink>
标签有80%的占空比。这个标签几乎接近实际效果,不过真正的<blink>
只会影响文本:
.blink {
animation: blink-animation 1s steps(5, start) infinite;
-webkit-animation: blink-animation 1s steps(5, start) infinite;
}
@keyframes blink-animation {
to {
visibility: hidden;
}
}
@-webkit-keyframes blink-animation {
to {
visibility: hidden;
}
}
This is <span class="blink">blinking</span> text.
您可以在此处了解更多关于Keyframe Animations的信息。
blink { animation: blink 1s steps(5, start) infinite; -webkit-animation: blink 1s steps(5, start) infinite; }
)。这样,您只需使用 <blink>
标签,而不是 <span class="blink">
=) - 416E64726577让我教你一个小诀窍。
正如Arkanciscan所说的那样,你可以使用CSS3过渡效果。但是他的解决方案与原始的“<a>
”标签看起来不同。
你真正需要做的是:
@keyframes blink {
50% {
opacity: 0.0;
}
}
.blink {
animation: blink 1s step-start 0s infinite;
}
<span class="blink">Blink</span>
0% 100% { opacity: 1.0; }
这部分似乎是多余的,因为它们是默认值,对吧? - jamadagniblink
元素本身设置样式,可以使用上面的代码(将 .blink
替换为 blink
),并在 CSS 中添加 display: block
(我认为它是一个块级元素)。让我们把邪恶带回来! :-) - Claudia尝试使用这个CSS
@keyframes blink {
0% { color: red; }
100% { color: black; }
}
@-webkit-keyframes blink {
0% { color: red; }
100% { color: black; }
}
.blink {
-webkit-animation: blink 1s linear infinite;
-moz-animation: blink 1s linear infinite;
animation: blink 1s linear infinite;
}
This is <span class="blink">blink</span>
你需要使用浏览器/供应商特定的前缀:http://jsfiddle.net/es6e6/1/.
visibility
或opacity
都是不必要的 - 您只需使用 color
即可。这样做的好处是仅将“闪烁”应用于文本:
blink {
display: inline;
color: inherit;
animation: blink 1s steps(1) infinite;
-webkit-animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { color: transparent; } }
@-webkit-keyframes blink { 50% { color: transparent; } }
Here is some text, <blink>this text will blink</blink>, this will not.
Fiddle: http://jsfiddle.net/2r8JL/
我要为此下地狱:
=keyframes($name)
@-webkit-keyframes #{$name}
@content
@-moz-keyframes #{$name}
@content
@-ms-keyframes #{$name}
@content
@keyframes #{$name}
@content
+keyframes(blink)
25%
zoom: 1
opacity: 1
65%
opacity: 1
66%
opacity: 0
100%
opacity: 0
body
font-family: sans-serif
font-size: 4em
background: #222
text-align: center
.blink
color: rgba(#fff, 0.9)
+animation(blink 1s 0s reverse infinite)
+transform(translateZ(0))
.table
display: table
height: 5em
width: 100%
vertical-align: middle
.cell
display: table-cell
width: 100%
height: 100%
vertical-align: middle
http://codepen.io/anon/pen/kaGxC(使用Bourbon的Sass)
Undefined mixin 'experimental'.
错误,因此看起来它无法编译和显示闪烁动画。 - user456814.blink {
-webkit-animation: blink 1s step-end infinite;
animation: blink 1s step-end infinite;
}
@-webkit-keyframes blink { 50% { visibility: hidden; }}
@keyframes blink { 50% { visibility: hidden; }}
This is <span class="blink">blink</span>
.blinking {
-webkit-animation: 1s blink ease infinite;
-moz-animation: 1s blink ease infinite;
-ms-animation: 1s blink ease infinite;
-o-animation: 1s blink ease infinite;
animation: 1s blink ease infinite;
}
@keyframes "blink" {
from,
to {
opacity: 0;
}
50% {
opacity: 1;
}
}
@-moz-keyframes blink {
from,
to {
opacity: 0;
}
50% {
opacity: 1;
}
}
@-webkit-keyframes "blink" {
from,
to {
opacity: 0;
}
50% {
opacity: 1;
}
}
@-ms-keyframes "blink" {
from,
to {
opacity: 0;
}
50% {
opacity: 1;
}
}
@-o-keyframes "blink" {
from,
to {
opacity: 0;
}
50% {
opacity: 1;
}
}
<span class="blinking">I am smoothly blinking</span>
在我的情况下,它可以以1秒的间隔闪烁文本。
.blink_me {
color:#e91e63;
font-size:140%;
font-weight:bold;
padding:0 20px 0 0;
animation: blinker 1s linear infinite;
}
@keyframes blinker {
50% { opacity: 0.4; }
}
@keyframes blink {
50% {
opacity: 0.0;
}
}
@-webkit-keyframes blink {
50% {
opacity: 0.0;
}
}
atom-text-editor::shadow .bracket-matcher .region {
border:none;
background-color: rgba(195,195,255,0.1);
border-bottom: 1px solid rgb(155,155,255);
box-shadow: 0px 0px 9px 4px rgba(155,155,255,0.1);
border-radius: 3px;
animation: blink 2s steps(115, start) infinite;
-webkit-animation: blink 2s steps(115, start) infinite;
}
@keyframes blink {
50% {
color: transparent;
}
}
.loader__dot {
animation: 1s blink infinite;
}
.loader__dot:nth-child(2) {
animation-delay: 250ms;
}
.loader__dot:nth-child(3) {
animation-delay: 500ms;
}
Loading <span class="loader__dot">.</span><span class="loader__dot">.</span><span class="loader__dot">.</span>
@-webkit-keyframes
规则放在未加前缀的@keyframes
规则之后,有些甚至把-webkit-animation
声明也放在未加前缀的声明之后。 - BoltClock