Hi, there.
My goal is Horizontal/Vertical center the spinner
inside the button but I don’t really understand why
on earth is aligned to the bottom
See the demo
.box{
width: 150px;
margin: 0 auto;
}
.loader,
.loader::before,
.loader::after {
width: 1.5em;
height: 1.5em;
border-radius: 50%;
animation: buttonSpinner 1.8s infinite ease-in-out;
animation-fill-mode: both;
}
.loader {
position: relative;
margin: 0 auto;
font-size: 8px;
color: inherit;
text-indent: -9999em;
transform: translateZ(0);
animation-delay: -.16s;
}
.loader::before,
.loader::after {
position: absolute;
top: 0;
content: "";
}
.loader::before {
left: -3.5em;
animation-delay: -.32s;
}
.loader::after {
left: 3.5em;
}
@keyframes buttonSpinner {
0%,
80%,
100% {
box-shadow: 0 2.5em 0 -1.3em;
}
40% {
box-shadow: 0 2.5em 0 0;
}
}
<div class="box">
<button class="btn btn-primary btn-lg btn-block" type="submit">
<div class="loader">Loading...</div>
</button>
</div>