為什么在span里設(shè)置文字顏色沒有效果,<!DOCTYPE html><html><head> <meta charset="UTF-8" /> <title>顯示當(dāng)前時(shí)間.htm</title> <style> .timer{ width: 150px; height: 20px; line-height: 20px; background-color: black; text-align: center; margin: 30px auto; /*color: rgb(255,255,255);*/ } .clock{ color: rgb(255,255,255); } </style></head><body> <div class="timer"> <span id="clock">1</span> </div> <script> function distime(){ var elt = document.getElementById("clock") var now = new Date(); elt.innerHTML = now.toLocaleTimeString() setTimeout(distime,1000) } window.onload = distime; </script></body></html>效果圖:
關(guān)于文字顏色的一個(gè)小問題
慕哥9229398
2018-08-28 08:15:28