CSS3圓形時鐘效果程式碼
本章節分享一段程式碼例項,它實現了圓形時鐘效果。
程式碼例項如下:
[HTML] 純文字檢視 複製程式碼執行程式碼<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>螞蟻部落</title> <style type="text/css"> .divBox { width: 600px; height: 600px; position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; margin: auto; } .circle { width: 400px; height: 400px; border-radius: 50%; position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; margin: auto; border: 12px solid #000; } .line { height: 20px; width: 0px; border: 8px solid #000; position: absolute; } .lineTop { top: 0px; left: 0px; right: 0px; margin: 0 auto; } .lineBottom { bottom: 0px; left: 0px; right: 0px; margin: 0 auto; } .lineLeft { left: 0px; top: 0px; bottom: 0px; margin: auto; transform: rotate(90deg); } .lineRight { right: 0px; top: 0px; bottom: 0px; margin: auto; transform: rotate(90deg); } .line1 { height: 10px; border: 4px solid #000; position: absolute; top: 27px; right: 98px; transform: rotate(30deg); } .line2 { height: 10px; border: 4px solid #000; position: absolute; top: 98px; right: 27px; transform: rotate(60deg); } .line4 { height: 10px; border: 4px solid #000; position: absolute; bottom: 98px; right: 27px; transform: rotate(-60deg); } .line5 { height: 10px; border: 4px solid #000; position: absolute; bottom: 27px; right: 98px; transform: rotate(-30deg); } .line7 { height: 10px; border: 4px solid #000; position: absolute; bottom: 27px; left: 98px; transform: rotate(30deg); } .line8 { height: 10px; border: 4px solid #000; position: absolute; bottom: 98px; left: 27px; transform: rotate(60deg); } .line10 { height: 10px; border: 4px solid #000; position: absolute; top: 98px; left: 27px; transform: rotate(-60deg); } .line11 { height: 10px; border: 4px solid #000; position: absolute; top: 27px; left: 98px; transform: rotate(-30deg); } .center { width: 0px; height: 0px; border-radius: 50%; position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; margin: auto; border: 20px solid #000; } .hourLine { width: 120px; border: 6px solid #000; border-top-right-radius: 50%; border-bottom-right-radius: 50%; position: absolute; left: 132px; right: 0px; margin: 197px auto; transform: rotate(-90deg); animation: hour 43200s linear infinite; } .minuteLine { width: 130px; border: 4px solid #000; position: absolute; left: 138px; right: 0px; margin: 197px auto; transform: rotate(-90deg); animation: minute 3600s linear infinite; } .secondLine { width: 140px; border: 2px solid #000; position: absolute; left: 144px; right: 0px; margin: 197px auto; transform: rotate(-90deg); transform-origin: 0% 50%; animation: second 60s linear infinite; } @keyframes second { 0% { transform: rotate(-90deg); } 100% { transform: rotate(270deg); } } @keyframes minute { 0% { transform: rotate(-90deg); } 100% { transform: rotate(270deg); } } @keyframes hour { 0% { transform: rotate(-90deg); } 100% { transform: rotate(270deg); } } </style> </head> <body> <div class="divBox"> <div class="circle"> <div class="line lineTop"></div> <div class="line lineBottom"></div> <div class="line lineLeft"></div> <div class="line lineRight"></div> <div class="line_1 line1"></div> <div class="line_1 line2"></div> <div class="line_1 line4"></div> <div class="line_1 line5"></div> <div class="line_1 line7"></div> <div class="line_1 line8"></div> <div class="line_1 line10"></div> <div class="line_1 line11"></div> <div class="center"></div> <div class="hourLine"></div> <div class="minuteLine"></div> <div class="secondLine"></div> </div> <div class="lineDom"> </div> </div> </body> </html>
相關文章
- canvas圓形時鐘效果Canvas
- css3動態圓形鐘錶效果CSSS3
- css3和js實現的圓形鐘錶效果程式碼例項CSSS3JS
- canvas實現的圓形時鐘效果Canvas
- javascript圓形電子鐘錶效果程式碼例項JavaScript
- SVG圓形鐘錶效果SVG
- JavaScript圓形鐘錶效果JavaScript
- js和css3實現的圓形鐘錶效果JSCSSS3
- canvas實現的圓形鐘錶效果程式碼例項Canvas
- CSS3圓形進度條效果CSSS3
- jquery自動走動的圓形鐘錶效果程式碼例項jQuery
- javascript圓形鐘錶程式碼例項JavaScript
- css3橢圓形程式碼例項CSSS3
- CSS3紅色心形效果程式碼CSSS3
- JavaScript動態圓形鐘錶效果詳解JavaScript
- css實現圓形、橢圓和半圓效果程式碼例項CSS
- CSS3標懸浮圓形縮放效果CSSS3
- CSS3圓形旋轉變大動畫效果CSSS3動畫
- CSS3心形效果程式碼例項CSSS3
- canvas繪製圓形鐘錶程式碼例項Canvas
- jquery和css實現的圓形鐘錶效果jQueryCSS
- canvas實現的圓形走動鐘錶效果Canvas
- CSS3梯形效果程式碼例項CSSS3
- css3實現的圓角效果程式碼例項CSSS3
- CSS3空心圓效果CSSS3
- CSS3實現的div圓角效果程式碼例項CSSS3
- CSS3 實現的鐘表效果程式碼例項CSSS3
- css3鋸齒形邊框效果程式碼例項CSSS3
- CSS3圓角表格效果CSSS3
- css3和javascript實現的時鐘效果CSSS3JavaScript
- CSS圓形圖片效果CSS
- 圓形放大的hover效果
- Swift如何純程式碼實現時鐘效果Swift
- 實時變化的時鐘效果程式碼例項
- JavaScript 動態圓形鐘錶JavaScript
- canvas圓形隨機漂浮效果Canvas隨機
- CSS3圓環效果程式碼CSSS3
- CSS3箭靶效果程式碼CSSS3