Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <input id="long-tail" type="checkbox"/><label for="long-tail" class="btn">Long Tail</label>

<b>Single DIV Loading ring in Pure CSS</b>

<!--- This div below is the main DOM element for the demo -->
<div class="loader-ring"></div>


<a href="https://codepen.io/collection/khwrE">See my other interesting loaders in pure CSS</a>
              
            
!

CSS

              
                /**
 * This work is licensed under the Creative Commons
 * Attribution 3.0 Unported License. To view a copy
 * of this license, visit http://creativecommons.org/licenses/by/3.0/.
 *
 * Author: Girish Sharma <[email protected]>
 */

/* Demo specific styles begin */

* {margin: 0; padding: 0;}
body {	
	background: #222;
}
.loader-ring {
  top: calc(50% - 100px);
  left: 50%;
  pointer-events: none;
}
#long-tail {
  visibility: hidden;
}
.btn {
  position: absolute;
  cursor: pointer;
  min-width: 90px;
  min-height: 90px;
  line-height: 90px;
  background: #25292C;
  margin: auto auto;
  top: calc(50% - 50px);
  left: calc(50% - 50px);
  text-align: center;
  border-radius: 999px;
  color: rgba(155,155,155,1);
  text-shadow: -1px -1px 0px rgba(255,255,255,0.8), 1px 1px 2px rgba(0,0,0,1);
  font-family: sans-serif;
  box-shadow: inset 1px 1px 2px rgba(255,255,255,0.3), 
              inset 3px 15px 45px rgba(255,255,255,0.1),
              inset -1px -1px 2px rgba(0,0,0,0.5), 
              inset -3px -15px 45px rgba(0,0,0,0.2),
              1px 5px 30px -4px rgba(0,0,0,1);
  transition: 0.1s ease-out;
}

.btn:before {
  content: "";
  cursor: pointer;
  background: #1A1A1A;
  width: 120px;
  height: 120px;
  position: absolute;
  top: -15px;
  left: -15px;
  z-index: -99;
  border-radius: 999px;
  box-shadow: inset -1px -1px 2px rgba(255,255,255,0.3), 
    inset -5px -15px 40px rgba(255,255,255,0.1),
    inset 1px 1px 2px rgba(0,0,0,0.5), 
    inset 5px 15px 40px rgba(0,0,0,0.2),
    -2px -40px 50px -20px rgba(255,255,255,0.1),
    2px 35px 50px -10px rgba(0,0,0,0.4),
    0px 0px 25px 8px rgba(60,60,60,1);
}

.btn:active, input:checked + .btn {
  text-shadow: 1px 1px 0px rgba(255,255,255,0.15);
  box-shadow: inset 1px 1px 2px rgba(255,255,255,0.3), 
              inset 3px 15px 45px rgba(0,0,0,0.2),
              inset -1px -1px 2px rgba(0,0,0,0.5), 
              inset -3px -15px 45px rgba(255,255,255,0.1),
              1px 5px 10px -4px rgba(0,0,0,1);
}
a {
  font-family: arial,sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  position: fixed;
  bottom: 0;
  right: 0;
  margin: 5px;
  color: #555;
}
a:hover {
  color: #888;
}
b {
  position: absolute;
  left: 50%;
  margin-right: -50%;
  transform: translateX(-50%);
  top: calc(50% - 200px);
  color: rgba(155,155,155,1);
  font-family: sans-serif;
}
/* Demo specific styles end */

.loader-ring {
  position: absolute;
  height: 100px;
  width: 100px;
  border-radius: 0 100% 0 0;
  border: 1px solid white;
  border-width: 0px 5px 0px 0px;
  box-shadow: 5px 1px 2px -4px white, inset -4px 1px 3px -4px white;
  transform-origin: 0px 100%;
  animation: rotate 1s linear infinite;
}

.loader-ring:after {
  position: absolute;
  height: 1px;
  width: 1px;
  top: 100%;
  left: calc(100% + 2px);
  border-radius: 100%;
  border-width: 0;
  background: white;
  box-shadow: 0px 0 3px 5px white;
  content: '';
}

#long-tail:checked ~ .loader-ring:before {
  position: absolute;
  height: 200%;
  width: 200%;
  top: -1px;
  left: calc(-100% - 1px);
  border-radius: 100%;
  border: 1px solid rgba(255,255,255,.5);
  border-width: 1px 0 0;
  transform-origin: 0px 0px;
  content: '';
}

#long-tail:checked ~ .loader-ring {
  animation-duration: .8s;
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console