css可以让网页文字闪烁吗?

html-css012

css可以让网页文字闪烁吗?,第1张

这句css代码就是文字闪烁text-decoration:blink不过很可惜,IE、Chrome 或 Safari 不支持 "blink" 属性值,所以只有在 Firefox 和 Opera 下支持这 CSS 实现在闪动效果。

加上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>