182 lines
3.7 KiB
CSS
182 lines
3.7 KiB
CSS
/* Reset and base styles */
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: Arial, Helvetica, sans-serif;
|
|
background-color: #ffffff;
|
|
height: 100vh;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* Clock container */
|
|
.clock-container {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
width: 100%;
|
|
height: 100%;
|
|
padding: 20px;
|
|
}
|
|
|
|
/* Main clock face */
|
|
.clock {
|
|
position: relative;
|
|
width: 300px;
|
|
height: 300px;
|
|
background-color: #f0f0f0;
|
|
border: 8px solid #333333;
|
|
border-radius: 50%;
|
|
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
/* Numbers positioning */
|
|
.number {
|
|
position: absolute;
|
|
color: #000000;
|
|
font-weight: bold;
|
|
font-size: 18px;
|
|
}
|
|
|
|
.number span {
|
|
display: block;
|
|
text-align: center;
|
|
line-height: 1;
|
|
}
|
|
|
|
.number-1 { top: 15%; left: 75%; transform: translate(-50%, -50%); }
|
|
.number-2 { top: 27%; left: 90%; transform: translate(-50%, -50%); }
|
|
.number-3 { top: 50%; left: 95%; transform: translate(-50%, -50%); }
|
|
.number-4 { top: 73%; left: 90%; transform: translate(-50%, -50%); }
|
|
.number-5 { top: 85%; left: 75%; transform: translate(-50%, -50%); }
|
|
.number-6 { top: 90%; left: 50%; transform: translate(-50%, -50%); }
|
|
.number-7 { top: 85%; left: 25%; transform: translate(-50%, -50%); }
|
|
.number-8 { top: 73%; left: 10%; transform: translate(-50%, -50%); }
|
|
.number-9 { top: 50%; left: 5%; transform: translate(-50%, -50%); }
|
|
.number-10 { top: 27%; left: 10%; transform: translate(-50%, -50%); }
|
|
.number-11 { top: 15%; left: 25%; transform: translate(-50%, -50%); }
|
|
.number-12 { top: 10%; left: 50%; transform: translate(-50%, -50%); }
|
|
|
|
/* Clock hands */
|
|
.hand {
|
|
position: absolute;
|
|
bottom: 50%;
|
|
left: 50%;
|
|
transform-origin: bottom center;
|
|
transform: translateX(-50%) rotate(0deg);
|
|
transition: transform 0.5s ease-in-out;
|
|
}
|
|
|
|
.hour-hand {
|
|
width: 6px;
|
|
height: 80px;
|
|
background-color: #000000;
|
|
border-radius: 3px;
|
|
z-index: 1;
|
|
}
|
|
|
|
.minute-hand {
|
|
width: 4px;
|
|
height: 120px;
|
|
background-color: #000000;
|
|
border-radius: 2px;
|
|
z-index: 2;
|
|
}
|
|
|
|
.second-hand {
|
|
width: 2px;
|
|
height: 140px;
|
|
background-color: #ff0000;
|
|
border-radius: 1px;
|
|
z-index: 3;
|
|
transition: transform 0.1s cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
}
|
|
|
|
/* Center pivot */
|
|
.center-pivot {
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
width: 16px;
|
|
height: 16px;
|
|
background-color: #333333;
|
|
border: 2px solid #ffffff;
|
|
border-radius: 50%;
|
|
transform: translate(-50%, -50%);
|
|
z-index: 4;
|
|
}
|
|
|
|
/* Responsive design */
|
|
@media (max-width: 768px) {
|
|
.clock {
|
|
width: 280px;
|
|
height: 280px;
|
|
}
|
|
|
|
.number {
|
|
font-size: 16px;
|
|
}
|
|
|
|
.hour-hand {
|
|
height: 75px;
|
|
width: 5px;
|
|
}
|
|
|
|
.minute-hand {
|
|
height: 110px;
|
|
width: 3px;
|
|
}
|
|
|
|
.second-hand {
|
|
height: 130px;
|
|
width: 2px;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.clock {
|
|
width: 250px;
|
|
height: 250px;
|
|
border-width: 6px;
|
|
}
|
|
|
|
.number {
|
|
font-size: 14px;
|
|
}
|
|
|
|
.hour-hand {
|
|
height: 65px;
|
|
width: 4px;
|
|
}
|
|
|
|
.minute-hand {
|
|
height: 95px;
|
|
width: 3px;
|
|
}
|
|
|
|
.second-hand {
|
|
height: 115px;
|
|
width: 2px;
|
|
}
|
|
|
|
.center-pivot {
|
|
width: 14px;
|
|
height: 14px;
|
|
}
|
|
}
|
|
|
|
/* Animation for smooth rotation */
|
|
@keyframes smooth-rotation {
|
|
from {
|
|
transform: translateX(-50%) rotate(var(--current-rotation, 0deg));
|
|
}
|
|
to {
|
|
transform: translateX(-50%) rotate(calc(var(--current-rotation, 0deg) + 360deg));
|
|
}
|
|
} |