forked from Chalarangelo/30-seconds-of-css
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Chalarangelo#18 from atomiks/donut-spinner
[FEATURE] Add donut-spinner snippet
- Loading branch information
Showing
7 changed files
with
1,000 additions
and
35 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
### Donut spinner | ||
|
||
Creates a donut spinner that can be used to indicate the loading of content. | ||
|
||
#### HTML | ||
|
||
```html | ||
<div class="donut"></div> | ||
``` | ||
|
||
#### CSS | ||
|
||
```css | ||
@keyframes donut-spin { | ||
0% { transform: rotate(0deg); } | ||
100% { transform: rotate(360deg); } | ||
} | ||
.donut { | ||
display: inline-block; | ||
border: 4px solid rgba(0, 0, 0, 0.25); | ||
border-left-color: blue; | ||
border-radius: 50%; | ||
width: 20px; | ||
height: 20px; | ||
animation: donut-spin 1.2s linear infinite; | ||
} | ||
``` | ||
|
||
#### Demo | ||
|
||
<div class="snippet-demo"> | ||
<div class="snippet-demo__donut-spinner"></div> | ||
</div> | ||
|
||
<style> | ||
@keyframes snippet-demo__donut-spin { | ||
0% { transform: rotate(0deg); } | ||
100% { transform: rotate(360deg);} | ||
} | ||
.snippet-demo__donut-spinner { | ||
display: inline-block; | ||
border: 4px solid rgba(0, 0, 0, 0.25); | ||
border-left-color: blue; | ||
border-radius: 50%; | ||
width: 20px; | ||
height: 20px; | ||
animation: snippet-demo__donut-spin 1.2s linear infinite; | ||
} | ||
</style> | ||
|
||
#### Explanation | ||
|
||
Use a semi-transparent `border` for the whole element, except one side that will | ||
serve as the loading indicator for the donut. Use `animation` to rotate the element. | ||
|
||
#### Browser support | ||
|
||
<span class="snippet__support-note">⚠️ Requires prefixes for full support.</span> | ||
|
||
* https://caniuse.com/#feat=css-animation | ||
* https://caniuse.com/#feat=transforms2d |