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
- SVG圓形鐘錶效果SVG
- CSS3圓環效果程式碼CSSS3
- CSS3圓形進度條效果CSSS3
- CSS3紅色心形效果程式碼CSSS3
- 一個圓形時鐘
- CSS3心形效果程式碼例項CSSS3
- CSS3標懸浮圓形縮放效果CSSS3
- CSS3梯形效果程式碼例項CSSS3
- JavaScript動態圓形鐘錶效果詳解JavaScript
- canvas繪製圓形鐘錶程式碼例項Canvas
- CSS3空心圓效果CSSS3
- Swift如何純程式碼實現時鐘效果Swift
- CSS3箭靶效果程式碼CSSS3
- CSS3 loadding效果程式碼CSSS3
- CSS圓形圖片效果CSS
- 圓形放大的hover效果
- CSS3現菱形效果程式碼CSSS3
- CSS3環形輻射效果CSSS3
- JavaScript 動態圓形鐘錶JavaScript
- CSS3滾動條效果程式碼CSSS3
- CSS3折角效果程式碼CSSS3
- CSS3日食效果程式碼CSSS3
- css3水滴效果程式碼例項CSSS3
- CSS3進度條效果程式碼CSSS3
- CSS3皮卡丘效果程式碼CSSS3
- CSS橢圓效果程式碼例項CSS
- box-shadow圓角效果程式碼
- css3晃動效果程式碼例項CSSS3
- CSS3旋轉風車效果程式碼CSSS3
- CSS3旋轉效果程式碼例項CSSS3
- css繪製圓形程式碼例項CSS
- CSS3繪製圖形圖案效果CSSS3
- CSS3六角形程式碼CSSS3
- CSS3滑過光束效果程式碼例項CSSS3
- CSS3小黃人效果程式碼例項CSSS3
- css3折角效果程式碼例項CSSS3
- CSS3背景漸變效果程式碼例項CSSS3