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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="grid">
  <div class="ball"></div>
</div>
              
            
!

CSS

              
                .grid{
  width: 100%;
  height: 100%;
  
  display: grid;
  grid-template-columns: 20px 0fr 20px 1fr 20px;
  animation: pong-h 2s linear infinite alternate,
    pong-v 1.4s linear infinite alternate;
  will-change: grid-template-columns, grid-template-rows;
  
  /*quick and dirty hack to fix the bounds */
  background-image: linear-gradient(transparent 40px, darkgrey 40px, darkgrey calc(100% - 90px), transparent 0);
  padding-top: 50px;
}

.grid::before, .grid::after{
  content: "";
  height: 100px;
  width: 20px;
  background: white;
  border-radius: 20px;
  grid-row: 2;
  transform: translateY(-50%);
}

.grid::after{
  grid-column: 5 / 6;
}

.ball{
  width: 20px;
  height: 20px; 
  border-radius: 50%;
  background-color: white;
  grid-column: 3 / 4;
  grid-row: 2;
  transform: translateY(-50%);
}

@keyframes pong-h{
  from{
   grid-template-columns: 20px 0fr 20px 1fr 20px;
  }
  to{
   grid-template-columns: 20px 1fr 20px 0fr 20px;
  }
}

@keyframes pong-v{
  from{
   grid-template-rows: 0fr auto;
  }
  to{
   grid-template-rows: 1fr auto;
  }
}

html, body{
  height: 100%;
  background: black;
}

*{
  box-sizing: border-box;
}
              
            
!

JS

              
                
              
            
!
999px

Console