我想創建一個自動啓動然後循環的3秒倒計時。從字面上看,只是說'3',然後用'2'代替它,最後代替'1'。純粹的CSS3(3,2,1)倒計時
到目前爲止,我試圖代碼是這樣的:
*[class].countdown:before {
content: '3' !important;
-webkit-animation:countdowns 3s ease-in-out infinite;
-moz-animation:countdowns 3s ease-in-out infinite;
-ms-animation:countdowns 3s ease-in-out infinite;
-o-animation:countdowns 3s ease-in-out infinite;
animation:countdowns 3s ease-in-out infinite;
}
@-webkit-keyframes countdowns {
33% {content: '3' !important;}
66% {content: '2' !important;}
99% {content: '1' !important;}
}
然後,我只是有這樣的HTML:
<span class="countdown"></span>
然而,這只是顯示「3」,僅此而已。有人有什麼建議嗎?謝謝!
檢查此鏈接http://thecodeplayer.com/walkthrough/make-a-stopwatch-using-css3-without-images-or-javascript – Aru 2014-11-05 10:32:06
倒計時不是關於造型:它是您的網頁中的信息,因此它應該在HTML代碼中,然後通過JS進行動畫。爲了告訴屏幕閱讀者這些變化,'aria-live'屬性的實現非常簡單:[MDN](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions)[MSDN ](http://msdn.microsoft.com/fr-fr/library/ie/dd433065%28v=vs.85%29.aspx) – FelipeAls 2014-11-05 11:26:42