Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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

              
                <div class="container">
  <div class="pokeball"></div>
  <div class="pokeball pokeball--great"></div>
  <div class="pokeball pokeball--ultra"></div>
    <div class="pokeball pokeball--master"></div>
</div>

              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Cabin+Condensed:wght@700&display=swap&text=M');

$size: 60px;
$white: #fff;
$black: #000;
$lightgray: #f1f1f1;
$darkgray: #ccc;
$red: #f00;
$lightred: #ff7f7f;

$greatball: #1182BF;
$greatball-stripe: #EB3937;

$ultraball: #2E2E2E;
$ultraball-stripe: #F7B100;

$masterball: #5A0DA4;
$masterball-stripe: #B7426A;

body {
  background: $lightgray;
}

.container {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  height: 100vh;
  padding: 1rem;
}

.pokeball {
  --top: #{$red};
  --bottom: #{$white};
  --button: #{$lightgray};
  --blur: 0;
  --delay: 1s;
  position: relative;
  width: $size;
  height: $size;
  margin: 2rem auto;
  overflow: hidden;
  background: linear-gradient(var(--top), var(--top) 46%, $black 46%, $black 54%, var(--bottom) 52%);
  border: 3px solid $black;
  border-radius: 50%;
  box-shadow: inset -5px -2px 0 0 rgba(0, 0, 0, 0.1);
  animation: shake 1.5s cubic-bezier(.36,.07,.19,.97) 3, blink .5s alternate 7;
  animation-delay: var(--delay);
  
  &::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 20px;
    height: 20px;
    background: radial-gradient(var(--button), var(--button) 50%, $darkgray 50%, $darkgray 60%, $white 60%);
    border: 3px solid $black;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: background 0.3s ease-in-out;
    filter: blur(var(--blur));
  }
  
  &--great {
    --top: #{$greatball};
    --stripe: #{$greatball-stripe};
    --delay: 2.3s;
    
    &::before {
      box-shadow: 0px -4px 0 0 var(--top);
    }
    
    &::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: conic-gradient(
     transparent 30deg, var(--stripe) 30deg 58deg, transparent 58deg 302deg, var(--stripe) 302deg 330deg, transparent 330deg);
      border-radius: 50%;
    }
  }
  
  &--ultra {
    --top: #{$ultraball};
    --stripe: #{$ultraball-stripe};
    --delay: 0.7s;
    
    &::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 48%;
      background: linear-gradient(to right, var(--top) 10%, var(--stripe) 10% 25%, transparent 25% 75%, var(--stripe) 75% 90%, var(--top) 90%), radial-gradient(circle at bottom, transparent 55%, var(--stripe) 55%);
    }
  }
  
  &--master {
    --top: #{$masterball};
    --stripe: #{$masterball-stripe};
    --delay: 1.8s;
    
    &::after {
      content: 'M';
      position: absolute;
      top: 0;
      left: 0;
      display: block;
      width: 100%;
      height: 100%;
      padding-top: 4px;
      color: rgba($white, 0.8);
      font-weight: bold;
      font-family: 'Cabin Condensed', sans-serif;
      font-size: 0.7rem;
      text-align: center;
      background: radial-gradient(closest-corner at 8px 8px, var(--stripe) 80%, transparent 80%), radial-gradient(farthest-corner at 94% 5px, var(--stripe) 16%,transparent 16%);
    }
  }
}

// Shake & blink animation modified from: Rau https://codepen.io/raubaca/pen/obaZmG
@keyframes shake {
  0% { transform: translate(0, 0) rotate(0); }
  20% { transform: translate(-10px, 0) rotate(-20deg); }
  30% { transform: translate(10px, 0) rotate(20deg); }
  50% { transform: translate(-10px, 0) rotate(-10deg); }
  60% { transform: translate(10px, 0) rotate(10deg); }
  100% { transform: translate(0, 0) rotate(0); }
}

@keyframes blink {
  from { 
    --button: #{$lightgray};
    --blur: 0; 
  }
  to { 
    --button: #{$lightred};
    --blur: 0.5px; 
  }
}

// Don't do the animation if the user prefers reduced motion.
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none;
  }
}
              
            
!

JS

              
                /*
Single Div Pokeballs from Generation 1
By: Jacque Schrag
https://codepen.io/jschrag/pen/wvKjzQa 
*/
              
            
!
999px

Console