加上js代码就可以了
html代码
<span id="blink">闪烁文字</span>
JavaScript代码:
<script type = "text/javascript" >
function blinklink() {
if (!document.getElementById('blink').style.color) {
document.getElementById('blink').style.color = "red"
}
if (document.getElementById('blink').style.color == "red") {
document.getElementById('blink').style.color = "black"
} else {
document.getElementById('blink').style.color = "red"
}
timer = setTimeout("blinklink()", 100)
}
function stoptimer() {
clearTimeout(timer)
}
blinklink()
</script>
<h2 class="text-gradient">CSS如何实现文字颜色渐变的实例</h2><style>
.text-gradient {
display: inline-block
color: green
font-size: 10em
font-family: '微软雅黑'
background-image: -webkit-gradient(linear, 0 0, 0 bottom, from(rgba(0, 0, 0, 1)), to(rgba(51, 51, 51, 1)))
-webkit-background-clip: text
-webkit-text-fill-color: transparent
}
</style>