fengchuanyu 2 maanden geleden
bovenliggende
commit
228304b37d
1 gewijzigde bestanden met toevoegingen van 66 en 0 verwijderingen
  1. 66 0
      8_CSS3/练习题1_时钟.html

+ 66 - 0
8_CSS3/练习题1_时钟.html

@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        ul{
+            margin:0;
+            padding: 0;
+        }
+        .box{
+            width: 402px;
+            height: 402px;
+            border:1px dashed #000;
+            margin:100px auto;
+        }
+        .clock{
+            width: 400px;
+            height: 400px;
+            border:1px solid #000;
+            border-radius: 50%;
+            position: relative;
+        }
+        .clock li{
+            list-style: none;
+            width: 4px;
+            height: 8px;
+            background-color: #000;
+            position: absolute;
+            left: 50%;
+            top: 0;
+            transform-origin: 0 200px;
+        }
+        /* .clock li:nth-child(1){
+            transform: rotate(0deg);
+        }
+        .clock li:nth-child(2){
+            transform: rotate(6deg);
+        }
+        .clock li:nth-child(3){
+            transform: rotate(12deg);
+        } */
+        .clock li:nth-child(5n+1){
+            height: 16px;
+        }
+    </style>
+</head>
+<body>
+    <div class="box">
+        <div class="clock">
+            <ul>
+                
+            </ul>
+        </div>
+    </div>
+    <script>
+        let oUl = document.getElementsByTagName("ul")[0];
+        for(let i = 0;i<60;i++){
+            let oLi = document.createElement("li");
+            oLi.style.transform = `rotate(${i*6}deg)`;
+            oUl.appendChild(oLi);
+        }
+    </script>
+</body>
+</html>