新的HTML/CSS -试图使一个闪烁,弹跳,彩虹标题的生命,“可怕的文本”,但它只是看起来空白。基于这里的示例,https://codepen.io/raaasin/pen/quvHr。
有什么不对吗?只要我删除CSS颜色更改元素,它就能工作。
<head>
<title>This is awesome</title>
<style>
.awesome {
font-family: futura;
font-style: italic;
width:100%;
margin: 0 auto;
text-align: center;
color:#313131;
font-size:45px;
font-weight: bold;
position: absolute;
-webkit-animation:colorchange 20s infinite alternate;
}
@-webkit-keyframes colorchange {
0% { color: blue; }
10% { color: #8e44ad; }
20% { color: #1abc9c; }
30% { color: #d35400; }
40% { color: blue; }
50% { color: #34495e; }
60% { color: blue; }
70% { color: #2980b9; }
80% { color: #f1c40f; }
90% { color: #2980b9; }
100% { color: pink; }
}
</style>
</head>
<body onload="blink();">
<html>
<body style="background-color:black;">
<font color="green">
<marquee direction="down" width="1000" height="100" behavior="alternate">
<marquee behavior="alternate">
<h1><div id="blinking"><p class="awesome">Awesome Text</p></div></h1>
</marquee>
</marquee>
</font>
</html>
<script>
function blink() {
var f = document.getElementById('blinking');
setInterval(function() {
f.style.display = (f.style.display == 'none' ? '' : 'none');
}, 300);
}
</script>
发布于 2018-06-20 16:52:01
如果你移除position: absolute;,它就会开始弹跳
-webkit-animation:colorchange 2s infinite alternate; 它是20秒,所以我把它缩短到2,换到你喜欢的:)
https://stackoverflow.com/questions/50953317
复制相似问题