Skip to content

Instantly share code, notes, and snippets.

@Ultrabenosaurus
Created September 18, 2012 14:01
Show Gist options
  • Save Ultrabenosaurus/3743293 to your computer and use it in GitHub Desktop.
Save Ultrabenosaurus/3743293 to your computer and use it in GitHub Desktop.
CSS Animations clock with seconds, minutes and hours
.loader{
color: #555;
font-family: sans-serif;
font-size: 3em;
text-align: center;
-webkit-border-radius: 50%;
border-radius: 50%;
border: 5px solid #555;
width:100px;
height:100px;
position:relative;
}
.center{
position: absolute;
width:100px;
height:100px;
text-align: center;
margin-top: 6px;
color: black;
}
.second-hand{
position: absolute;
width:100px;
height:100px;
text-align: center;
color: red !important;
-webkit-animation: rotateit 60s linear infinite;
-moz-animation: rotateit 60s linear infinite;
animation: rotateit 60s linear infinite;
}
.minute-hand{
position: absolute;
width:100px;
height:100px;
text-align: center;
color: black !important;
-webkit-animation: rotateit 3600s linear infinite;
-moz-animation: rotateit 3600s linear infinite;
animation: rotateit 3600s linear infinite;
}
.hour-hand{
position: absolute;
width:100px;
height:100px;
text-align: center;
-webkit-animation: rotateit 86400s linear infinite;
-moz-animation: rotateit 86400s linear infinite;
animation: rotateit 86400s linear infinite;
}
@-webkit-keyframes rotateit {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@-moz-keyframes rotateit {
from {
-moz-transform: rotate(0deg);
}
to {
-moz-transform: rotate(360deg);
}
}
@keyframes rotateit {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
<!-- expanded version of this loader animation: https://gist.github.com/3743065 -->
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>CSS Clock</title>
</head>
<body>
<div class="loader">
<div class='second-hand'>I</div>
<div class='minute-hand'>I</div>
<div class='hour-hand'>I</div>
<div class='center'>.</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment