<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>css3时钟</title>
<style>
.box{
width: 300px;
height: 300px;
border-radius:50%;
border: 5px solid#ccc;
margin: 100pxauto;
position:relative;
}
.kedu{
width: 300px;
height: 300px;
border-radius:50%;
position:relative;
overflow: hidden;
}
.kedu div{
height: 300px;
position:absolute;
left: 50%;
}
.kedudiv:nth-child(1){
width: 6px;
background: #333;
margin-left: -3px;
}
.kedudiv:nth-child(2){
width: 2px;
background: #666;
margin-left: -3px;
transform:rotate(30deg);
}
.kedudiv:nth-child(3){
width: 2px;
background: #666;
margin-left: -3px;
transform:rotate(60deg);
}
.kedudiv:nth-child(4){
width: 6px;
background: #333;
margin-left: -3px;
transform:rotate(90deg);
}
.kedudiv:nth-child(5){
width: 2px;
background: #666;
margin-left: -3px;
transform:rotate(120deg);
}
.kedudiv:nth-child(6){
width: 2px;
background: #666;
margin-left: -3px;
transform:rotate(150deg);
}
.disc{
width: 20px;
height: 20px;
border-radius:50%;
background: #000;
position:absolute;
top: 50%;
left: 50%;
margin-left:-10px;
margin-top: -10px;
z-index: 2;
}
.middisc{
width: 260px;
height: 260px;
border-radius:50%;
background: #fff;
position:absolute;
top: 50%;
left: 50%;
margin-left:-130px;
margin-top:-130px;
}
.hour{
width: 6px;
height: 60px;
background: #000;
position:absolute;
top: -50px;
left: 50%;
margin-left: -3px;
transform-origin:bottom center;
animation: move43200s steps(60) 0s infinite;
}
.minu{
width: 4px;
height: 80px;
background: green;
position:absolute;
top: -70px;
left: 50%;
margin-left: -2px;
transform-origin:bottom center;
animation: move3600s steps(60) 0s infinite;
}
.second{
width: 2px;
height: 100px;
background: #f00;
position:absolute;
top: -90px;
left: 50%;
margin-left: -1px;
transform-origin:bottom center;
-webkit-animation:move 60s steps(60) infinite;
}
.cover{
width: 20px;
height: 20px;
border-radius:50%;
background: #000;
position:absolute;
}
@keyframes move{
0%{
transform:rotate(0deg);
}
100%{
transform:rotate(360deg);
}
}
</style>
</head>
<body>
<divclass="box">
<divclass="kedu">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<divclass="disc">
<divclass="hour"></div>
<divclass="minu"></div>
<divclass="second"></div>
<divclass="cover"></div>
</div>
<divclass="middisc">
</div>
</div>
</body>
</html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>css3时钟</title>
<style>
.box{
width: 300px;
height: 300px;
border-radius:50%;
border: 5px solid#ccc;
margin: 100pxauto;
position:relative;
}
.kedu{
width: 300px;
height: 300px;
border-radius:50%;
position:relative;
overflow: hidden;
}
.kedu div{
height: 300px;
position:absolute;
left: 50%;
}
.kedudiv:nth-child(1){
width: 6px;
background: #333;
margin-left: -3px;
}
.kedudiv:nth-child(2){
width: 2px;
background: #666;
margin-left: -3px;
transform:rotate(30deg);
}
.kedudiv:nth-child(3){
width: 2px;
background: #666;
margin-left: -3px;
transform:rotate(60deg);
}
.kedudiv:nth-child(4){
width: 6px;
background: #333;
margin-left: -3px;
transform:rotate(90deg);
}
.kedudiv:nth-child(5){
width: 2px;
background: #666;
margin-left: -3px;
transform:rotate(120deg);
}
.kedudiv:nth-child(6){
width: 2px;
background: #666;
margin-left: -3px;
transform:rotate(150deg);
}
.disc{
width: 20px;
height: 20px;
border-radius:50%;
background: #000;
position:absolute;
top: 50%;
left: 50%;
margin-left:-10px;
margin-top: -10px;
z-index: 2;
}
.middisc{
width: 260px;
height: 260px;
border-radius:50%;
background: #fff;
position:absolute;
top: 50%;
left: 50%;
margin-left:-130px;
margin-top:-130px;
}
.hour{
width: 6px;
height: 60px;
background: #000;
position:absolute;
top: -50px;
left: 50%;
margin-left: -3px;
transform-origin:bottom center;
animation: move43200s steps(60) 0s infinite;
}
.minu{
width: 4px;
height: 80px;
background: green;
position:absolute;
top: -70px;
left: 50%;
margin-left: -2px;
transform-origin:bottom center;
animation: move3600s steps(60) 0s infinite;
}
.second{
width: 2px;
height: 100px;
background: #f00;
position:absolute;
top: -90px;
left: 50%;
margin-left: -1px;
transform-origin:bottom center;
-webkit-animation:move 60s steps(60) infinite;
}
.cover{
width: 20px;
height: 20px;
border-radius:50%;
background: #000;
position:absolute;
}
@keyframes move{
0%{
transform:rotate(0deg);
}
100%{
transform:rotate(360deg);
}
}
</style>
</head>
<body>
<divclass="box">
<divclass="kedu">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<divclass="disc">
<divclass="hour"></div>
<divclass="minu"></div>
<divclass="second"></div>
<divclass="cover"></div>
</div>
<divclass="middisc">
</div>
</div>
</body>
</html>