css spinner code example
Example 1: css loading spinner
.loader {
border: 16px solid
border-top: 16px solid
border-radius: 50%;
width: 120px;
height: 120px;
animation: spin 2s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
<div class="loader"></div>
Example 2: css loading spinner with text
.centered {
text-align: center;
}
.spinner.loading {
display: none;
padding: 50px;
text-align: center;
}
.loading-text {
width: 90px;
position: absolute;
top: calc(50% - 15px);
left: calc(50% - 45px);
text-align: center;
}
.spinner.loading:before {
content: "";
height: 90px;
width: 90px;
margin: -15px auto auto -15px;
position: absolute;
top: calc(50% - 45px);
left: calc(50% - 45px);
border-width: 8px;
border-style: solid;
border-color:
border-radius: 100%;
animation: rotation .7s infinite linear;
}
@keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
Example 3: css loader
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: ['to-string-loader', 'css-loader'],
},
],
},
};
Example 4: css loader
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: [
'handlebars-loader', // handlebars loader expects raw resource string
'extract-loader',
'css-loader',
],
},
],
},
};