I have this div with two spans inside, I made loader which has circle filling with red color, over and over again. Everything is working great in Chrome but on EGDE this circle is so buggy that makes no sense.
When I inspect it on EDGE I get everything stricken through for a span, transform, animation... But when I check it on Can I use, it says that every browser is compatible. Is there any prefix or anything that can fix this problem on edge. I tried to put compatibility meta tag in HEAD, doesn't work.
HTML
<section>
<div><span></span><span></span></div>
</section>
CSS
#-webkit-keyframes flip {
50% {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
50.1% {
-webkit-transform: scale3d(-1, 1, 1);
transform: scale3d(-1, 1, 1);
}
100% {
-webkit-transform: scale3d(-1, 1, 1);
transform: scale3d(-1, 1, 1);
}
}
#keyframes flip {
50% {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
50.1% {
-webkit-transform: scale3d(-1, 1, 1);
transform: scale3d(-1, 1, 1);
}
100% {
-webkit-transform: scale3d(-1, 1, 1);
transform: scale3d(-1, 1, 1);
}
}
#-webkit-keyframes load-one {
0% {
-webkit-transform: translate3d(-25%, -50%, 0);
transform: translate3d(-25%, -50%, 0);
box-shadow: 0 0 0 0 #fd395b;
}
49% {
-webkit-transform: translate3d(-25%, -50%, 0) rotate(179deg);
transform: translate3d(-25%, -50%, 0) rotate(179deg);
box-shadow: 0 3em 0 0 #fd395b;
}
50% {
-webkit-transform: translate3d(-25%, -50%, 0) rotate(180deg);
transform: translate3d(-25%, -50%, 0) rotate(180deg);
box-shadow: 0 3em 0 0 #fd395b;
}
100% {
-webkit-transform: translate3d(-25%, -50%, 0) rotate(180deg);
transform: translate3d(-25%, -50%, 0) rotate(180deg);
box-shadow: 0 3em 0 0 #fd395b;
}
}
#keyframes load-one {
0% {
-webkit-transform: translate3d(-25%, -50%, 0);
transform: translate3d(-25%, -50%, 0);
box-shadow: 0 0 0 0 #fd395b;
}
49% {
-webkit-transform: translate3d(-25%, -50%, 0) rotate(179deg);
transform: translate3d(-25%, -50%, 0) rotate(179deg);
box-shadow: 0 3em 0 0 #fd395b;
}
50% {
-webkit-transform: translate3d(-25%, -50%, 0) rotate(180deg);
transform: translate3d(-25%, -50%, 0) rotate(180deg);
box-shadow: 0 3em 0 0 #fd395b;
}
100% {
-webkit-transform: translate3d(-25%, -50%, 0) rotate(180deg);
transform: translate3d(-25%, -50%, 0) rotate(180deg);
box-shadow: 0 3em 0 0 #fd395b;
}
}
#-webkit-keyframes load-two {
0% {
-webkit-transform: translate3d(112.5%, 50%, 0);
transform: translate3d(112.5%, 50%, 0);
box-shadow: 0 0 0 0 #fd395b;
}
50% {
-webkit-transform: translate3d(112.5%, 50%, 0);
transform: translate3d(112.5%, 50%, 0);
box-shadow: 0 0 0 0 #fd395b;
}
75% {
-webkit-transform: translate3d(112.5%, 50%, 0) rotate(179deg);
transform: translate3d(112.5%, 50%, 0) rotate(179deg);
box-shadow: 0 -3em 0 0 #fd395b;
}
80% {
-webkit-transform: translate3d(112.5%, 50%, 0) rotate(180deg);
transform: translate3d(112.5%, 50%, 0) rotate(180deg);
box-shadow: 0 -3em 0 0 #fd395b;
}
100% {
-webkit-transform: translate3d(112.5%, 50%, 0) rotate(180deg);
transform: translate3d(112.5%, 50%, 0) rotate(180deg);
box-shadow: 0 -3em 0 0 #fd395b;
}
}
#keyframes load-two {
0% {
-webkit-transform: translate3d(112.5%, 50%, 0);
transform: translate3d(112.5%, 50%, 0);
box-shadow: 0 0 0 0 #fd395b;
}
50% {
-webkit-transform: translate3d(112.5%, 50%, 0);
transform: translate3d(112.5%, 50%, 0);
box-shadow: 0 0 0 0 #fd395b;
}
75% {
-webkit-transform: translate3d(112.5%, 50%, 0) rotate(179deg);
transform: translate3d(112.5%, 50%, 0) rotate(179deg);
box-shadow: 0 -3em 0 0 #fd395b;
}
80% {
-webkit-transform: translate3d(112.5%, 50%, 0) rotate(180deg);
transform: translate3d(112.5%, 50%, 0) rotate(180deg);
box-shadow: 0 -3em 0 0 #fd395b;
}
100% {
-webkit-transform: translate3d(112.5%, 50%, 0) rotate(180deg);
transform: translate3d(112.5%, 50%, 0) rotate(180deg);
box-shadow: 0 -3em 0 0 #fd395b;
}
}
section {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
height: 8em;
width: 8em;
background-color: rgba(211,211,211,0.7);
border-radius: 50%;
}
.gray-circle{
background: gray;
width: 8em;
height: 8em;
display: flex;
align-items
}
div {
width: 3em;
height: 3em;
position: relative;
border-radius: 50%;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
-webkit-animation: flip 3s infinite;
animation: flip 3s infinite;
}
div span {
position: absolute;
top: 0;
bottom: 0;
z-index: 1;
overflow: hidden;
background: #fff;
}
div span:before {
content: '';
z-index: -1;
position: absolute;
background: #fd395b;
top: -50%;
bottom: -50%;
width: 400%;
}
div span:nth-of-type(1) {
border-top-right-radius: 5em;
border-bottom-right-radius: 5em;
left: 50%;
right: 0;
}
div span:nth-of-type(1):before {
right: 0;
-webkit-transform: translate3d(-25%, -50%, 0);
transform: translate3d(-25%, -50%, 0);
-webkit-transform-origin: bottom right;
transform-origin: bottom right;
-webkit-animation: load-one 1.5s cubic-bezier(1, 0, 1, 1) infinite alternate;
animation: load-one 1.5s cubic-bezier(1, 0, 1, 1) infinite alternate;
}
div span:nth-of-type(2) {
border-top-left-radius: 5em;
border-bottom-left-radius: 5em;
right: 50%;
left: 0;
}
div span:nth-of-type(2):before {
right: 50%;
-webkit-transform-origin: top left;
transform-origin: top left;
-webkit-animation: load-two 1.5s cubic-bezier(0, 0.65, 0.35, 1) infinite alternate;
animation: load-two 1.5s cubic-bezier(0, 0.65, 0.35, 1) infinite alternate;
}
Codepen
Unfortunately certain webkit functions do not currently work on Edge. You can submit a feature request here: https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer
Although certain webkit functions have supposedly been in development since 2016 and still have yet to be properly implemented into the browser.
Related
I have a panel with components inside and once the submit button is pressed, an overlay appears, but is not covering the entire parent panel (see picture) when I have scrolled all the way to the bottom. Also, the spinner need to be always in the center whether I am scrolling or not. I used position: fixed; but I don't know if that's the best practice.
CSS
.pay-storage-container {
$inner-padding: 16px;
height: 100vh;
position: fixed;
right: 0;
top: 0;
width: 325px;
z-index: 2;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
background-color: #fff;
.loading-container {
position: absolute;
background-color: rgba(0, 0, 0, 0.2);
width: 100%;
height: 100%;
top: 0;
left: 0;
img {
position: fixed;
top: 50%;
right: 18%;
animation: spinner 1s linear infinite;
}
}
}
HTML
<div class="pay-storage-container {{toggleSideBar ? 'showSideBar' : 'closeSideBar'}}">
<div class="header-container">
<div class="header">Pay Storage</div>
<span class='close-icon csx-common_delete' (click)="onToggleSideBar(false)"></span>
</div>
<div class="pay-storage-inner">
<app-equipment-summary [equipmentSummary]='equipmentSummary'></app-equipment-summary>
<app-credit-card #creditCardForm></app-credit-card>
<div class="loading-container" *ngIf="isLoading">
<img src="assets/spinner.svg" alt="">
</div>
</div>
<div class="footer-container">
<!-- <button pButton type="button" label="Submit Payment" class="x-primary-green-400" [disabled]='!creditCardForm.creditCardForm.valid || isLoading'
(click)="onSubmitPayment()"></button> -->
<button pButton type="button" label="Submit Payment" class="x-primary-green-400" [disabled]='isLoading' (click)="onSubmitPayment()"></button>
</div>
<div *ngIf="paymentMessage$ | async as message" class="pay-storage-inner pay-storage-success">
<app-payment-success [paymentSuccess]="paymentSuccess" (close)="onToggleSideBar($event)"></app-payment-success>
</div>
</div>
I don't think that there is anything wrong with using position:fixed to keep your spinner in the center of the page.
Also, if you want to fully overlay your content then your loading-container needs to be at the very bottom of the content you want overlayed. This code below should just overlay pay-storage-container:
<div class="pay-storage-container {{toggleSideBar ? 'showSideBar' : 'closeSideBar'}}">
<div class="header-container">
<div class="header">Pay Storage</div>
<span class='close-icon csx-common_delete' (click)="onToggleSideBar(false)"></span>
</div>
<div class="pay-storage-inner">
<app-equipment-summary [equipmentSummary]='equipmentSummary'></app-equipment-summary>
<app-credit-card #creditCardForm></app-credit-card>
</div>
<div class="footer-container">
<!-- <button pButton type="button" label="Submit Payment" class="x-primary-green-400" [disabled]='!creditCardForm.creditCardForm.valid || isLoading'
(click)="onSubmitPayment()"></button> -->
<button pButton type="button" label="Submit Payment" class="x-primary-green-400" [disabled]='isLoading' (click)="onSubmitPayment()"></button>
</div>
<div *ngIf="paymentMessage$ | async as message" class="pay-storage-inner pay-storage-success">
<app-payment-success [paymentSuccess]="paymentSuccess" (close)="onToggleSideBar($event)"></app-payment-success>
</div>
<div class="loading-container" *ngIf="isLoading">
<img src="assets/spinner.svg" alt="">
</div>
</div>
I am sharing a sample code snippet which centers overlay spinner for all dimensions. You can edit your CSS accordingly to achieve centered spinner with overlay.
/* Absolute Center Spinner */
.loading {
position: fixed;
z-index: 999;
height: 2em;
width: 2em;
overflow: show;
margin: auto;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
/* Transparent Overlay */
.loading:before {
content: '';
display: block;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.3);
}
/* :not(:required) hides these rules from IE9 and below */
.loading:not(:required) {
/* hide "loading..." text */
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.loading:not(:required):after {
content: '';
display: block;
font-size: 10px;
width: 1em;
height: 1em;
margin-top: -0.5em;
-webkit-animation: spinner 1500ms infinite linear;
-moz-animation: spinner 1500ms infinite linear;
-ms-animation: spinner 1500ms infinite linear;
-o-animation: spinner 1500ms infinite linear;
animation: spinner 1500ms infinite linear;
border-radius: 0.5em;
-webkit-box-shadow: rgba(0, 0, 0, 0.75) 1.5em 0 0 0, rgba(0, 0, 0, 0.75) 1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) 0 1.5em 0 0, rgba(0, 0, 0, 0.75) -1.1em 1.1em 0 0, rgba(0, 0, 0, 0.5) -1.5em 0 0 0, rgba(0, 0, 0, 0.5) -1.1em -1.1em 0 0, rgba(0, 0, 0, 0.75) 0 -1.5em 0 0, rgba(0, 0, 0, 0.75) 1.1em -1.1em 0 0;
box-shadow: rgba(0, 0, 0, 0.75) 1.5em 0 0 0, rgba(0, 0, 0, 0.75) 1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) 0 1.5em 0 0, rgba(0, 0, 0, 0.75) -1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) -1.5em 0 0 0, rgba(0, 0, 0, 0.75) -1.1em -1.1em 0 0, rgba(0, 0, 0, 0.75) 0 -1.5em 0 0, rgba(0, 0, 0, 0.75) 1.1em -1.1em 0 0;
}
/* Animation */
#-webkit-keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#-moz-keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#-o-keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
<div class="loading">Loading…</div>
`
I need these glowing bubbles to move around smoothly like galaxies in a universe.
There are four bubbles here just moving up, I can't seem to make them move in rounds like a galaxy scaling(1) from center and while moving to the right-top and going into deep space and decrease scaling(0.3) and while moving to the right direction, "something like that".
How do we do this in pure css?
The glowing bubbles code
body {
background: #26323e;
}
#keyframes greenPulse {
0% {
box-shadow: 0 0 30px #4bbec8
}
50% {
box-shadow: 0 0 80px #4bbec8
}
100% {
box-shadow: 0 0 30px #4bbec8
}
}
#-webkit-keyframes greenPulse {
0% {
-webkit-box-shadow: 0 0 30px #4bbec8
}
50% {
-webkit-box-shadow: 0 0 80px #4bbec8
}
100% {
-webkit-box-shadow: 0 0 30px #4bbec8
}
}
#-moz-keyframes greenPulse {
0% {
-moz-box-shadow: 0 0 30px #4bbec8
}
50% {
-moz-box-shadow: 0 0 80px #4bbec8
}
100% {
-moz-box-shadow: 0 0 30px #4bbec8
}
}
#-o-keyframes greenPulse {
0% {
-o-box-shadow: 0 0 30px #4bbec8
}
50% {
-o-box-shadow: 0 0 80px #4bbec8
}
100% {
-o-box-shadow: 0 0 30px #4bbec8
}
}
#keyframes bubbleUp {
0% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 0
}
1% {
bottom: 110px;
-webkit-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-webkit-transform: scale(.8);
opacity: 1
}
95% {
bottom: 545px;
-webkit-transform: scale(.3);
opacity: 1
}
99% {
bottom: 550px;
-webkit-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 0
}
}
#-webkit-keyframes bubbleUp {
0% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 0
}
1% {
bottom: 110px;
-webkit-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-webkit-transform: scale(.8);
opacity: 1
}
95% {
bottom: 545px;
-webkit-transform: scale(.3);
opacity: 1
}
99% {
bottom: 550px;
-webkit-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 0
}
}
#-moz-keyframes bubbleUp {
0% {
bottom: 110px;
-moz-transform: scale(.9);
opacity: 0
}
1% {
bottom: 110px;
-moz-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-moz-transform: scale(.8);
opacity: 1
}
95% {
bottom: 545px;
-moz-transform: scale(.3);
opacity: 1
}
99% {
bottom: 550px;
-moz-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-moz-transform: scale(.9);
opacity: 0
}
}
#-o-keyframes bubbleUp {
0% {
bottom: 110px;
-o-transform: scale(.9);
opacity: 0
}
1% {
bottom: 110px;
-o-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-o-transform: scale(.8);
opacity: 1
}
95% {
bottom: 545px;
-o-transform: scale(.3);
opacity: 1
}
99% {
bottom: 550px;
-o-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-o-transform: scale(.9);
opacity: 0
}
}
#keyframes bubbleUp1 {
0% {
bottom: 120px;
transform: scale(.3);
opacity: 0
}
1% {
bottom: 80px;
transform: scale(.2);
opacity: 0
}
30% {
bottom: 90px;
transform: scale(.2);
opacity: 1
}
95% {
bottom: 500px;
transform: scale(.4);
opacity: 1
}
99% {
bottom: 550px;
transform: scale(.2);
opacity: 0
}
100% {
bottom: 140px;
transform: scale(.9);
opacity: 0
}
}
#-webkit-keyframes bubbleUp1 {
0% {
bottom: 120px;
-webkit-transform: scale(.3);
opacity: 0
}
1% {
bottom: 80px;
-webkit-transform: scale(.2);
opacity: 0
}
30% {
bottom: 90px;
-webkit-transform: scale(.2);
opacity: 1
}
95% {
bottom: 500px;
-webkit-transform: scale(.4);
opacity: 1
}
99% {
bottom: 550px;
-webkit-transform: scale(.2);
opacity: 0
}
100% {
bottom: 140px;
-webkit-transform: scale(.9);
opacity: 0
}
}
#-moz-keyframes bubbleUp1 {
0% {
bottom: 120px;
-moz-transform: scale(.3);
opacity: 0
}
1% {
bottom: 80px;
-moz-transform: scale(.2);
opacity: 0
}
30% {
bottom: 90px;
-moz-transform: scale(.2);
opacity: 1
}
95% {
bottom: 500px;
-moz-transform: scale(.4);
opacity: 1
}
99% {
bottom: 550px;
-moz-transform: scale(.2);
opacity: 0
}
100% {
bottom: 140px;
-moz-transform: scale(.9);
opacity: 0
}
}
#-o-keyframes bubbleUp1 {
0% {
bottom: 120px;
-o-transform: scale(.3);
opacity: 0
}
1% {
bottom: 80px;
-o-transform: scale(.2);
opacity: 0
}
30% {
bottom: 90px;
-o-transform: scale(.2);
opacity: 1
}
95% {
bottom: 500px;
-o-transform: scale(.4);
opacity: 1
}
99% {
bottom: 550px;
-o-transform: scale(.2);
opacity: 0
}
100% {
bottom: 140px;
-o-transform: scale(.9);
opacity: 0
}
}
#keyframes bubbleUp2 {
0% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
transform: scale(.9);
opacity: 1
}
95% {
bottom: 650px;
transform: scale(.3);
opacity: 1
}
99% {
bottom: 655px;
transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
}
#-webkit-keyframes bubbleUp2 {
0% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-webkit-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 1
}
95% {
bottom: 650px;
-webkit-transform: scale(.3);
opacity: 1
}
99% {
bottom: 655px;
-webkit-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
}
#-moz-keyframes bubbleUp2 {
0% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-moz-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-moz-transform: scale(.9);
opacity: 1
}
95% {
bottom: 650px;
-moz-transform: scale(.3);
opacity: 1
}
99% {
bottom: 655px;
-moz-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
}
#-o-keyframes bubbleUp2 {
0% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-o-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-o-transform: scale(.9);
opacity: 1
}
95% {
bottom: 650px;
-o-transform: scale(.3);
opacity: 1
}
99% {
bottom: 655px;
-o-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
}
#keyframes bubbleUp3 {
0% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
transform: scale(.9);
opacity: 1
}
95% {
bottom: 495px;
transform: scale(.3);
opacity: 1
}
99% {
bottom: 500px;
transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
}
#-webkit-keyframes bubbleUp3 {
0% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-webkit-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 1
}
95% {
bottom: 495px;
-webkit-transform: scale(.3);
opacity: 1
}
99% {
bottom: 500px;
-webkit-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
}
#-moz-keyframes bubbleUp3 {
0% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-moz-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-moz-transform: scale(.9);
opacity: 1
}
95% {
bottom: 495px;
-moz-transform: scale(.3);
opacity: 1
}
99% {
bottom: 500px;
-moz-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
}
#-o-keyframes bubbleUp3 {
0% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-o-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-o-transform: scale(.9);
opacity: 1
}
95% {
bottom: 495px;
-o-transform: scale(.3);
opacity: 1
}
99% {
bottom: 500px;
-o-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
}
#keyframes bubbleUp4 {
0% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
transform: scale(.9);
opacity: 1
}
95% {
bottom: 595px;
transform: scale(.3);
opacity: 1
}
99% {
bottom: 600px;
transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
transform: scale(1);
opacity: 0
}
}
#-webkit-keyframes bubbleUp4 {
0% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-webkit-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-webkit-transform: scale(.9);
opacity: 1
}
95% {
bottom: 595px;
-webkit-transform: scale(.3);
opacity: 1
}
99% {
bottom: 600px;
-webkit-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-webkit-transform: scale(1);
opacity: 0
}
}
#-moz-keyframes bubbleUp4 {
0% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-moz-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-moz-transform: scale(.9);
opacity: 1
}
95% {
bottom: 595px;
-moz-transform: scale(.3);
opacity: 1
}
99% {
bottom: 600px;
-moz-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-moz-transform: scale(1);
opacity: 0
}
}
#-o-keyframes bubbleUp4 {
0% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
1% {
bottom: 110px;
-o-transform: scale(.3);
opacity: 0
}
30% {
bottom: 110px;
-o-transform: scale(.9);
opacity: 1
}
95% {
bottom: 595px;
-o-transform: scale(.3);
opacity: 1
}
99% {
bottom: 600px;
-o-transform: scale(3);
opacity: 0
}
100% {
bottom: 110px;
-o-transform: scale(1);
opacity: 0
}
}
div#beaker {
width: 300px;
height: 700px;
margin: 0 auto;
position: relative
}
div#beaker span.glow {
width: 100%;
height: 100%;
background: ##222;
position: relative;
display: block;
border-radius: 200px;
animation: greenPulse 2s infinite;
-webkit-animation: greenPulse 2s infinite;
-moz-animation: greenPulse 2s infinite;
-o-animation: greenPulse 2s infinite;
}
div#beaker span.bubble {
background: #fff;
width: 80px;
height: 80px;
position: absolute;
display: block;
left: 110px;
bottom: 110px;
border-radius: 100px;
background: -moz-radial-gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -webkit-gradient(radial, center center, 0, center center, 100, from(rgba(75, 190, 200, .2)), to(rgba(255, 255, 255, .7)));
background: gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(9, 133, 167, 0.1) 51%, rgba(9, 133, 167, 0.3) 71%, rgba(9, 133, 167, .7) 100%);
animation: bubbleUp 4s infinite ease-in-out;
-webkit-animation: bubbleUp 4s infinite ease-in-out;
-o-animation: bubbleUp 4s infinite ease-in-out;
-moz-animation: bubbleUp 4s infinite ease-in-out;
}
div#beaker span.bubble1 {
background: #fff;
width: 70px;
height: 70px;
position: absolute;
display: block;
left: 115px;
bottom: 110px;
border-radius: 80px;
background: -moz-radial-gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -webkit-gradient(radial, center center, 0, center center, 100, from(rgba(75, 190, 200, .2)), to(rgba(255, 255, 255, .7)));
background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(9, 133, 167, 0.1) 51%, rgba(9, 133, 167, 0.3) 71%, rgba(9, 133, 167, .7) 100%);
animation: bubbleUp 5s infinite;
-webkit-animation: bubbleUp1 5s infinite;
-o-animation: bubbleUp1 5s infinite;
-moz-animation: bubbleUp1 5s infinite;
}
div#beaker span.bubble2 {
background: #fff;
width: 30px;
height: 30px;
position: absolute;
display: block;
left: 110px;
bottom: 110px;
border-radius: 60px;
background: -moz-radial-gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -webkit-gradient(radial, center center, 0, center center, 100, from(rgba(75, 190, 200, .2)), to(rgba(255, 255, 255, .7)));
background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(9, 133, 167, 0.1) 51%, rgba(9, 133, 167, 0.3) 71%, rgba(9, 133, 167, .7) 100%);
animation: bubbleUp 7s infinite;
-webkit-animation: bubbleUp2 7s infinite;
-o-animation: bubbleUp2 7s infinite;
-moz-animation: bubbleUp2 7s infinite;
}
div#beaker span.bubble3 {
background: #fff;
width: 50px;
height: 50px;
position: absolute;
display: block;
left: 140px;
bottom: 95px;
border-radius: 100px;
background: -moz-radial-gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -webkit-gradient(radial, center center, 0, center center, 100, from(rgba(75, 190, 200, .2)), to(rgba(255, 255, 255, .7)));
background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(9, 133, 167, 0.1) 51%, rgba(9, 133, 167, 0.3) 71%, rgba(9, 133, 167, .7) 100%);
animation: bubbleUp 10s infinite;
-webkit-animation: bubbleUp3 10s infinite;
-o-animation: bubbleUp3 10s infinite;
-moz-animation: bubbleUp3 10s infinite;
}
div#beaker span.bubble4 {
background: #fff;
width: 40px;
height: 40px;
position: absolute;
display: block;
left: 155px;
bottom: 110px;
border-radius: 100px;
background: -moz-radial-gradient(center 45deg, circle closest-corner, rgba(75, 190, 200, 0), rgba(75, 190, 200, .1), rgba(75, 190, 200, .3), rgba(255, 255, 255, .7));
background: -webkit-gradient(radial, center center, 0, center center, 100, from(rgba(75, 190, 200, .2)), to(rgba(255, 255, 255, .7)));
background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(9, 133, 167, 0.1) 51%, rgba(9, 133, 167, 0.3) 71%, rgba(9, 133, 167, .7) 100%);
animation: bubbleUp4 12s infinite;
-webkit-animation: bubbleUp4 12s infinite;
-o-animation: bubbleUp4 12s infinite;
-moz-animation: bubbleUp4 12s infinite;
}
<div id="lab">
<div id="beaker">
<span class="bubble"><span class="glow"></span></span>
<span class="bubble1"><span class="glow"></span></span>
<span class="bubble2"><span class="glow"></span></span>
<span class="bubble3"><span class="glow"></span></span>
<span class="bubble4"><span class="glow"></span></span>
</div>
</div>
My jsfiddle https://jsfiddle.net/pbged09z/
I am working on a CSS animation that should look similar to this and I am almost there, but I don't know how to get it work correctly.
For everyone who cannot or doesn't want to view the links:
Using CSS I want an animation that transforms a three bar menu icon into an X. I can make the "bars" overlap and rotate, but the strokes are far from being symmetrical.
this is my code:
HTML:
<div class="container">
<div class="centerized">
<div class="bar1"> </div>
<div class="bar2"> </div>
<div class="bar3"> </div>
</div>
</div>
SCSS:
#keyframes ani1{
0% {margin-bottom: 16%;}
50% {margin-bottom: none; transform: translate(0, 20px);}
100% {margin-bottom: none; transform: rotate(30deg);}
}
#keyframes ani2{
0% {margin-bottom: 16%; opacity: 1;}
75% {margin-bottom: none; opacity: 0;}
100% {margin-bottom: none; opacity: 0;}
}
#keyframes ani3{
0% {margin-bottom: 16%;}
50% {margin-bottom: none; transform: translate(0px, -20px);}
100% {margin-bottom: none; transform: rotate(-30deg);}
}
Since I believe the fault lies within the way I positioned the elements during the animation I am including this part. To see the whole code I suggest to click on the link above.
I added the CSS's to your html to make that animation. I guess you want the effect to be on hover as in your codepen:
.You-need-this-container {
position: absolute;
top: 50%;
left: 50%;
width: 400px;
height: 400px;
margin-top: -200px;
margin-left: -200px;
border-radius: 2px;
box-shadow: 1px 2px 10px 0px rgba(0, 0, 0, 0.3);
background: #3FAF82;
color: #fff;
}
.container {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.centerized {
width: 80px;
height: 52px;
cursor: pointer;
z-index: 50;
}
.centerized .bar1,
.centerized .bar2,
.centerized .bar3 {
height: 8px;
width: 100%;
background-color: #fff;
border-radius: 3px;
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.3);
-webkit-transition: background-color .2s ease-in-out;
transition: background-color .2s ease-in-out;
}
.centerized .bar1 {
-webkit-animation: animate-line-1-rev .7s ease-in-out;
animation: animate-line-1-rev .7s ease-in-out;
}
.centerized .bar2 {
margin: 14px 0;
-webkit-animation: animate-line-2-rev .7s ease-in-out;
animation: animate-line-2-rev .7s ease-in-out;
}
.centerized .bar3 {
-webkit-animation: animate-line-3-rev .7s ease-in-out;
animation: animate-line-3-rev .7s ease-in-out;
}
.centerized:hover .bar1,
.centerized:hover .bar2,
.centerized:hover .bar3 {
background-color: #fff;
}
.centerized:hover .bar1,
.centerized:hover .bar2,
.centerized:hover .bar3 {
background-color: #fff;
}
.centerized:hover .bar1 {
-webkit-animation: animate-line-1 0.7s cubic-bezier(0.3, 1, 0.7, 1) forwards;
animation: animate-line-1 0.7s cubic-bezier(0.3, 1, 0.7, 1) forwards;
}
.centerized:hover .bar2 {
-webkit-animation: animate-line-2 0.7s cubic-bezier(0.3, 1, 0.7, 1) forwards;
animation: animate-line-2 0.7s cubic-bezier(0.3, 1, 0.7, 1) forwards;
}
.centerized:hover .bar3 {
-webkit-animation: animate-line-3 0.7s cubic-bezier(0.3, 1, 0.7, 1) forwards;
animation: animate-line-3 0.7s cubic-bezier(0.3, 1, 0.7, 1) forwards;
}
.no-animation {
-webkit-animation: none !important;
animation: none !important;
}
#-webkit-keyframes animate-line-1 {
0% {
-webkit-transform: translate3d(0, 0, 0) rotate(0deg);
transform: translate3d(0, 0, 0) rotate(0deg);
}
50% {
-webkit-transform: translate3d(0, 22px, 0) rotate(0);
transform: translate3d(0, 22px, 0) rotate(0);
}
100% {
-webkit-transform: translate3d(0, 22px, 0) rotate(45deg);
transform: translate3d(0, 22px, 0) rotate(45deg);
}
}
#keyframes animate-line-1 {
0% {
-webkit-transform: translate3d(0, 0, 0) rotate(0deg);
transform: translate3d(0, 0, 0) rotate(0deg);
}
50% {
-webkit-transform: translate3d(0, 22px, 0) rotate(0);
transform: translate3d(0, 22px, 0) rotate(0);
}
100% {
-webkit-transform: translate3d(0, 22px, 0) rotate(45deg);
transform: translate3d(0, 22px, 0) rotate(45deg);
}
}
#-webkit-keyframes animate-line-2 {
0% {
-webkit-transform: scale(1);
transform: scale(1);
opacity: 1;
}
100% {
-webkit-transform: scale(0);
transform: scale(0);
opacity: 0;
}
}
#keyframes animate-line-2 {
0% {
-webkit-transform: scale(1);
transform: scale(1);
opacity: 1;
}
100% {
-webkit-transform: scale(0);
transform: scale(0);
opacity: 0;
}
}
#-webkit-keyframes animate-line-3 {
0% {
-webkit-transform: translate3d(0, 0, 0) rotate(0deg);
transform: translate3d(0, 0, 0) rotate(0deg);
}
50% {
-webkit-transform: translate3d(0, -22px, 0) rotate(0);
transform: translate3d(0, -22px, 0) rotate(0);
}
100% {
-webkit-transform: translate3d(0, -22px, 0) rotate(135deg);
transform: translate3d(0, -22px, 0) rotate(135deg);
}
}
#keyframes animate-line-3 {
0% {
-webkit-transform: translate3d(0, 0, 0) rotate(0deg);
transform: translate3d(0, 0, 0) rotate(0deg);
}
50% {
-webkit-transform: translate3d(0, -22px, 0) rotate(0);
transform: translate3d(0, -22px, 0) rotate(0);
}
100% {
-webkit-transform: translate3d(0, -22px, 0) rotate(135deg);
transform: translate3d(0, -22px, 0) rotate(135deg);
}
}
#-webkit-keyframes animate-line-1-rev {
0% {
-webkit-transform: translate3d(0, 22px, 0) rotate(45deg);
transform: translate3d(0, 22px, 0) rotate(45deg);
}
50% {
-webkit-transform: translate3d(0, 22px, 0) rotate(0);
transform: translate3d(0, 22px, 0) rotate(0);
}
100% {
-webkit-transform: translate3d(0, 0, 0) rotate(0deg);
transform: translate3d(0, 0, 0) rotate(0deg);
}
}
#keyframes animate-line-1-rev {
0% {
-webkit-transform: translate3d(0, 22px, 0) rotate(45deg);
transform: translate3d(0, 22px, 0) rotate(45deg);
}
50% {
-webkit-transform: translate3d(0, 22px, 0) rotate(0);
transform: translate3d(0, 22px, 0) rotate(0);
}
100% {
-webkit-transform: translate3d(0, 0, 0) rotate(0deg);
transform: translate3d(0, 0, 0) rotate(0deg);
}
}
#-webkit-keyframes animate-line-2-rev {
0% {
-webkit-transform: scale(0);
transform: scale(0);
opacity: 0;
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
opacity: 1;
}
}
#keyframes animate-line-2-rev {
0% {
-webkit-transform: scale(0);
transform: scale(0);
opacity: 0;
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
opacity: 1;
}
}
#-webkit-keyframes animate-line-3-rev {
0% {
-webkit-transform: translate3d(0, -22px, 0) rotate(135deg);
transform: translate3d(0, -22px, 0) rotate(135deg);
}
50% {
-webkit-transform: translate3d(0, -22px, 0) rotate(0);
transform: translate3d(0, -22px, 0) rotate(0);
}
100% {
-webkit-transform: translate3d(0, 0, 0) rotate(0deg);
transform: translate3d(0, 0, 0) rotate(0deg);
}
}
#keyframes animate-line-3-rev {
0% {
-webkit-transform: translate3d(0, -22px, 0) rotate(135deg);
transform: translate3d(0, -22px, 0) rotate(135deg);
}
50% {
-webkit-transform: translate3d(0, -22px, 0) rotate(0);
transform: translate3d(0, -22px, 0) rotate(0);
}
100% {
-webkit-transform: translate3d(0, 0, 0) rotate(0deg);
transform: translate3d(0, 0, 0) rotate(0deg);
}
}
<div class="You-need-this-container">
<div class="container">
<div class="centerized">
<div class="bar1"> </div>
<div class="bar2"> </div>
<div class="bar3"> </div>
</div>
</div>
</div>
I have This CSS3 animate code for shake effect in DIV action: (i copy this code from HERE)
CSS CODE:
.shake {
-webkit-animation-name: shake ;
animation-name: shake;
}
#-webkit-keyframes shake {
0%, 100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
10%,
30%,
50%,
70%,
90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0)
}
20%,
40%,
60%,
80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0)
}
}
#keyframes shake {
0%, 100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
10%,
30%,
50%,
70%,
90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0)
}
20%,
40%,
60%,
80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0)
}
}
Now, in action when i see div shake action not work!?
for see css effect, How do can i fix this ?
DEMO
The animated class is missing. Take a look here to find more information on how Animate.css works. You actually do not need to copy the code. You can include the library into the header of your document.
#-webkit-keyframes shake {
0%, 100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
10%,
30%,
50%,
70%,
90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0)
}
20%,
40%,
60%,
80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0)
}
}
#keyframes shake {
0%, 100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
10%,
30%,
50%,
70%,
90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0)
}
20%,
40%,
60%,
80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0)
}
}
/* add this class */
.animated {
-webkit-animation-duration:1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.shake {
-webkit-animation-name: shake;
animation-name: shake
}
<div class="animated shake">Shake this text</div>
Working, your missing the animation-duration: 4s;
#-webkit-keyframes shake {
0%, 100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
10%,
30%,
50%,
70%,
90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0)
}
20%,
40%,
60%,
80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0)
}
}
#keyframes shake {
0%, 100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
10%,
30%,
50%,
70%,
90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0)
}
20%,
40%,
60%,
80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0)
}
}
.shake {
-webkit-animation-name: shake;
animation-name: shake;
animation-duration: 4s;
}
Fiddle: http://jsfiddle.net/pjra0sqk/2/
It is becuase you didn't give animation-duration: 1s;
Just give it solved your issue.
.shake {
-webkit-animation-name: shake;
animation-name: shake;
animation-duration: 1s;
-webkit-animation-duration:1s;
}
Check your updated Fiddle.
General Code snippet to make a div shake. If anyone is still interested:
#myDiv {
/* Start the shake animation and make the animation last for 0.5 seconds */
animation: shake 0.5s;
/* When the animation is finished, start again */
animation-iteration-count: infinite;
/* Some additional styles for a better example */
background-color: #00ccff;
color: white;
text-align: center;
height: 200px;
width: 200px;
}
#keyframes shake {
0% {
transform: translate(1px, 1px) rotate(0deg);
}
10% {
transform: translate(-1px, -2px) rotate(-1deg);
}
20% {
transform: translate(-3px, 0px) rotate(1deg);
}
30% {
transform: translate(3px, 2px) rotate(0deg);
}
40% {
transform: translate(1px, -1px) rotate(1deg);
}
50% {
transform: translate(-1px, 2px) rotate(-1deg);
}
60% {
transform: translate(-3px, 1px) rotate(0deg);
}
70% {
transform: translate(3px, 1px) rotate(-1deg);
}
80% {
transform: translate(-1px, -1px) rotate(1deg);
}
90% {
transform: translate(1px, 2px) rotate(0deg);
}
100% {
transform: translate(1px, -2px) rotate(-1deg);
}
}
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Titel</title>
</head>
<body>
<div id="myDiv">Content of shaking div</div>
</body>
</html>
I am trying to create a spinner class that when assigned to any element, it should show an spinner overlay and centred.
I created this jfiddle of my current progress, but I am stuck, I can't seem to centre the spinner on the parent div.
See here: Example
HTML:
<div class="u-loading">
<div class="address-container u-border-all">
<input type="text" class="address__textbox address__textbox--line u-border-bottom">
<input type="text" class="address__textbox address__textbox--house-no u-border-right">
<input type="text" class="address__textbox address__textbox--street">
<input type="text" class="address__textbox address__textbox--line">
<input type="text" class="address__textbox address__textbox--line">
<input type="text" class="address__textbox address__textbox--line">
<input type="text" class="address__textbox address__textbox--postcode u-border-right u-border-top">
<select class="address__textbox address__country u-border-top">
<option value="Select a country" selected="selected" class="rps-placeholder">Select a country</option>
<option value="England">England</option>
<option value="Wales">Wales</option>
<option value="Scotland">Scotland</option>
</select>
</div>
</div>
CSS:
/*------------------------------------*\
##Loading
\*------------------------------------*/
/* Absolute Center CSS Spinner */
.u-loading {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
}
.u-loading:not(:required):after {
width: 100%;
height: 100%;
z-index: 9999;
overflow: visible;
position: relative;
content: '';
display: inherit;
font-size: 10px;
width: 1em;
height: 1em;
margin: 0 auto;
-webkit-animation: spinner 1500ms infinite linear;
-moz-animation: spinner 1500ms infinite linear;
-ms-animation: spinner 1500ms infinite linear;
-o-animation: spinner 1500ms infinite linear;
animation: spinner 1500ms infinite linear;
border-radius: 0.5em;
-webkit-box-shadow: rgba(0, 0, 0, 0.75) 1.5em 0 0 0, rgba(0, 0, 0, 0.75) 1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) 0 1.5em 0 0, rgba(0, 0, 0, 0.75) -1.1em 1.1em 0 0, rgba(0, 0, 0, 0.5) -1.5em 0 0 0, rgba(0, 0, 0, 0.5) -1.1em -1.1em 0 0, rgba(0, 0, 0, 0.75) 0 -1.5em 0 0, rgba(0, 0, 0, 0.75) 1.1em -1.1em 0 0;
box-shadow: rgba(0, 0, 0, 0.75) 1.5em 0 0 0, rgba(0, 0, 0, 0.75) 1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) 0 1.5em 0 0, rgba(0, 0, 0, 0.75) -1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) -1.5em 0 0 0, rgba(0, 0, 0, 0.75) -1.1em -1.1em 0 0, rgba(0, 0, 0, 0.75) 0 -1.5em 0 0, rgba(0, 0, 0, 0.75) 1.1em -1.1em 0 0;
}
/* Animation */
#-webkit-keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#-moz-keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#-o-keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
.u-border-all {
border: solid black 2px;
}
.address-container {
height: 200px;
width: 200px;
}
I tried position absolute but that affects the main div. I want to be able to assign this class to most elements and see a spinner.
Any suggestion?
/*------------------------------------*\
##Loading
\*------------------------------------*/
/* Absolute Center CSS Spinner */
.u-loading {
z-index: 9999;
}
.u-loading:not(:required):after {
width: 100%;
height: 100%;
z-index: 9999;
overflow: visible;
position: relative;
content: '';
display: inherit;
font-size: 10px;
width: 1em;
height: 1em;
margin: 0 auto;
-webkit-animation: spinner 1500ms infinite linear;
-moz-animation: spinner 1500ms infinite linear;
-ms-animation: spinner 1500ms infinite linear;
-o-animation: spinner 1500ms infinite linear;
animation: spinner 1500ms infinite linear;
border-radius: 0.5em;
-webkit-box-shadow: rgba(0, 0, 0, 0.75) 1.5em 0 0 0, rgba(0, 0, 0, 0.75) 1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) 0 1.5em 0 0, rgba(0, 0, 0, 0.75) -1.1em 1.1em 0 0, rgba(0, 0, 0, 0.5) -1.5em 0 0 0, rgba(0, 0, 0, 0.5) -1.1em -1.1em 0 0, rgba(0, 0, 0, 0.75) 0 -1.5em 0 0, rgba(0, 0, 0, 0.75) 1.1em -1.1em 0 0;
box-shadow: rgba(0, 0, 0, 0.75) 1.5em 0 0 0, rgba(0, 0, 0, 0.75) 1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) 0 1.5em 0 0, rgba(0, 0, 0, 0.75) -1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) -1.5em 0 0 0, rgba(0, 0, 0, 0.75) -1.1em -1.1em 0 0, rgba(0, 0, 0, 0.75) 0 -1.5em 0 0, rgba(0, 0, 0, 0.75) 1.1em -1.1em 0 0;
}
/* Animation */
#-webkit-keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#-moz-keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#-o-keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#keyframes spinner {
0% {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
.u-border-all {
border: solid black 2px;
}
.address-container {
height: 200px;
width: 200px;
}
.u-loading:not(:required)::after {
animation: 1500ms linear 0s normal none infinite running spinner;
border-radius: 0.5em;
box-shadow: 1.5em 0 0 0 rgba(0, 0, 0, 0.75), 1.1em 1.1em 0 0 rgba(0, 0, 0, 0.75), 0 1.5em 0 0 rgba(0, 0, 0, 0.75), -1.1em 1.1em 0 0 rgba(0, 0, 0, 0.75), -1.5em 0 0 0 rgba(0, 0, 0, 0.75), -1.1em -1.1em 0 0 rgba(0, 0, 0, 0.75), 0 -1.5em 0 0 rgba(0, 0, 0, 0.75), 1.1em -1.1em 0 0 rgba(0, 0, 0, 0.75);
content: "";
display: inherit;
font-size: 10px;
left: 50%;
margin: 0 auto;
overflow: visible;
position: fixed;
top: 50%;
z-index: 9999;
transform: translate(-50%, -50%);
}
.u-loading{position:relative}
<div class="u-loading">
<div class="address-container u-border-all">
<input type="text" class="address__textbox address__textbox--line u-border-bottom">
<input type="text" class="address__textbox address__textbox--house-no u-border-right">
<input type="text" class="address__textbox address__textbox--street">
<input type="text" class="address__textbox address__textbox--line">
<input type="text" class="address__textbox address__textbox--line">
<input type="text" class="address__textbox address__textbox--line">
<input type="text" class="address__textbox address__textbox--postcode u-border-right u-border-top">
<select class="address__textbox address__country u-border-top">
<option value="Select a country" selected="selected" class="rps-placeholder">Select a country</option>
<option value="England">England</option>
<option value="Wales">Wales</option>
<option value="Scotland">Scotland</option>
</select>
</div>
</div>
Try this
.u-loading:not(:required)::after {
animation: 1500ms linear 0s normal none infinite running spinner;
border-radius: 0.5em;
box-shadow: 1.5em 0 0 0 rgba(0, 0, 0, 0.75), 1.1em 1.1em 0 0 rgba(0, 0, 0, 0.75), 0 1.5em 0 0 rgba(0, 0, 0, 0.75), -1.1em 1.1em 0 0 rgba(0, 0, 0, 0.75), -1.5em 0 0 0 rgba(0, 0, 0, 0.75), -1.1em -1.1em 0 0 rgba(0, 0, 0, 0.75), 0 -1.5em 0 0 rgba(0, 0, 0, 0.75), 1.1em -1.1em 0 0 rgba(0, 0, 0, 0.75);
content: "";
display: inherit;
font-size: 10px;
height: 1em;
left: 50%;
margin: 0 auto;
overflow: visible;
position: absolute;
top: 50%;
width: 1em;
z-index: 9999;
}
Currently your spinner is in display: inline-block.
If you want to center it in its parent you could change its style to display: block along with margin: auto.