Snippets

CSS Loader

June 25, 2017

animation loader

CSS Loader
LOADING...
<div class="loader-wrapper"> <div class="loader"> <div class="ball"></div> <div class="ball"></div> <div class="ball"></div> </div> <div class="text">LOADING...</div> </div> .loader-wrapper { position: relative; width: 100%; height: 250px; z-index: 100; background: cornflowerblue; } .loader-wrapper .text { position: absolute; bottom: 0; left: 50%; -webkit-transform: translateX(-50%); -ms-transform: translateX(-50%); transform: translateX(-50%); margin: 0 0 100px; color: rgba(255, 255, 255, .7); text-transform: uppercase; font-size: 11px; font-family: sans-serif, helvetica; letter-spacing: .5px; } .loader { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); width: 300px; height: 24px; border-left: 8px solid #fff; border-right: 8px solid #fff; overflow: hidden; } .loader .ball { height: 8px; width: 0; background: white; position: relative; margin: 0; } .loader .ball:nth-child(1) { -webkit-animation: ball 2s ease-in-out infinite; animation: ball 2s ease-in-out infinite; } .loader .ball:nth-child(2) { -webkit-animation: ball 2s ease-in-out .1s infinite; animation: ball 2s ease-in-out .1s infinite; } .loader .ball:nth-child(3) { -webkit-animation: ball 2s ease-in-out .2s infinite; animation: ball 2s ease-in-out .2s infinite; } @-webkit-keyframes ball { 0% { left: 0; width: 0px; } 25% { left: 0; width: 300px; } 50% { left: 300px; width: 0px; } 75% { left: 0; width: 300px; } 100% { left: 0; width: 0px; } } @keyframes ball { 0% { left: 0; width: 0px; } 25% { left: 0; width: 300px; } 50% { left: 300px; width: 0px; } 75% { left: 0; width: 300px; } 100% { left: 0; width: 0px; } }

Related Content

Easy Way to Fix Anchor Links Scrolling Too Far

Stories

Easy Way to Fix Anchor Links Scrolling Too Far

Fixed navbar is a very popular way of displaying navigation when a page is scrolled, but you could run into a small detail that needs to be addressed.

How to Avoid Page Flickering When Scrollbars are Dynamically Shown or Hidden?

Stories

How to Avoid Page Flickering When Scrollbars are Dynamically Shown or Hidden?

There are certain cases when you want to dynamically manipulate the page height which will result in flickering.

Changing the Mouse Cursor in CSS With the cursor Property

Stories

Changing the Mouse Cursor in CSS With the cursor Property

Using CSS to change the cursor on your website is a great way to add a little bit of personality to your site.