Skip to content

Instantly share code, notes, and snippets.

@tanihiro
Created December 26, 2014 07:45
Show Gist options
  • Save tanihiro/7853f874522d7a981a8e to your computer and use it in GitHub Desktop.
Save tanihiro/7853f874522d7a981a8e to your computer and use it in GitHub Desktop.
CSS3で簡易的にローダーアニメーションを作成する
.loader {
position: absolute;
width: 50px; height: 50px;
top: 50%; left: 50%;
margin-top: -30px;
margin-left: -30px;
border: solid 5px #808080;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
}
.loader:after {
content: '';
display: block;
width: 50px; height: 50px;
border: solid 5px #fff;
margin: -5px 0 0 -5px;
border-right-color: transparent;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
-webkit-animation: spin 1s linear infinite;
-moz-animation: spin 1s linear infinite;
-o-animation: spin 1s linear infinite;
animation: spin 1s linear infinite;
}
@-webkit-keyframes spin {
100% {
-webkit-transform: rotate(360deg);
}
}
@-moz-keyframes spin {
100% {
-moz-transform: rotate(360deg);
}
}
@-o-keyframes spin {
100% {
-o-transform: rotate(360deg);
}
}
@keyframes spin {
100% {
transform: rotate(360deg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment