js实现颜色渐变文字效果代码:
<!-- js颜色渐变色文字 -->
<div id="moml">
<div style="text-align:center;">
颜色渐变文字效果
</div>
<script language="javascript">
function changeColor(){ var color="#f00|#0f0|#00f|#880|#808|#088|yellow|green|blue|gray"; color=color.split("|"); document.getElementById("moml").style.color=color[parseInt(Math.random() * color.length)]; } setInterval("changeColor()",200); </script>
</div>
css实现颜色渐变文字效果代码:
<!-- css颜色渐变变色文字 -->
<div id="momk">
<div style="text-align:center;">
颜色渐变文字效果
</div></div>
<style>
#momk{animation:change 10s infinite;font-weight:100; }
@keyframes change{0%{color:#5cb85c;}25%{color:#556bd8;}50%{color:#e40707;}75%{color:#66e616;}100% {color:#67bd31;}}
</style>