I'm doing a CSS loader, I want it to be right in the middle of the screen both horizontally and vertically but I can not.
.loader{
border: 16px solid #d4d4d4;
border-top: 16px solid #3498db;
border-bottom: 16px solid #3498db;
border-radius: 50%;
width: 60px;
height: 60px;
animation: spin 1.5s linear infinite;
position: fixed;
left : 50%;
bottom : 0;
right : 0;
top : 50%;
}
.loader-background {
min-width: 100vw;
min-height: 100vh;
max-width: 100vw;
max-height: 100vh;
width: 100vw;
height: 100vh;
position: absolute;
background-color: #eaeaea4a;
z-index: 9999;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
<div class="loader-background"><div class="loader"></div></div>
I tried to move them with the properties left,bottom,right,top
But I do not get the effect, and it gets out of sync when the screen is mobile.
Any suggestions of favor?