Pen Settings



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


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


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.


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.


                <div class="flick"></div>
Should flick 1 to 2

<div class="flick flick-end"></div>
Flick w/ step-end

<div class="flick flick-start"></div>
Flick w/ step-start

<div class="easy-as"></div>

<div class="easy-as easy-working"></div>
1-2-3 with the "fourth frame"

<div class="easy-as easy-borked"></div>
1-2-3 with the "fourth frame" showing and the "first frame" missing.

<div class="flick flick-working"></div>
Now we get some flicking action.


                body { padding: 1em; }

div {
  margin: 1em 0 .5em;
  width: 50px; height: 50px;

@keyframes countdown {  
  0% { background-position: 0 0; } 
  100% {background-position: 0 100%; } 

/* You think the following would flick between 1 and 2 forever, right? Steps() is supposed to split the output into an equal number of segments and jump between them, right?  */
.flick {
  animation: countdown 1s steps(2) infinite;
  background: url( 0 0 no-repeat;

/* That's weird. It's only going halfway between 1 and 2. Hmmm... 

Let's try experimenting with those "start" and "end" properties. Those worked great for me before! (See also */

.flick-end {
  animation: countdown 1s steps(1, end) infinite;

.flick-start {
  animation: countdown 1s steps(1, start) infinite;

/* Those look like they just skip us to the first or the last frame, though... Why is that?

According to: 
"Step(X, start/end) in turn enables to define how many steps are shown between each keyframe, where X stands for the steps and start/end defines if the first or the last keyframe should be omitted (defaults to end if omitted)."


Let's calm down and try a longer animation and see if we can at least get this thing moving again. */
.easy-as {
  animation: countdown 1s steps(2, end) infinite;
  background: url( 0 0 no-repeat;

/* What's happening here is that it's splitting the 1-2-3 image into three equal parts and then ignoring the last one, the "end." I have no idea why this is the case. But watch what happens when we add change the animation to have an extra "blank frame" at the end--remember that the 1-2-3 image is 150px high. By using background-position: 0 -150px, you'd think the last frame would be missing, as the image would be "off screen" at 100% */

@keyframes countdownTo3 {  
  0% { background-position: 0 0; } 
  100% {background-position: 0 -150px; } 

.easy-working {
  animation: countdownTo3 1s steps(3) infinite;

/* It works perfectly, though, as the last "blank frame" at 100% is consumer by steps(3, end)--remember "end" is the default value, so no need to specify that value unless using start. Speaking of which, here's what happens when you use that...*/

.easy-borked {
  animation: countdownTo3 1s steps(3, start) infinite;

/* Now that we know all this, let's revisit flick above. */

@keyframes countdownTo2 {  
  0% { background-position: 0 0; } 
  100% {background-position: 0 -100px; } 

.flick-working {
  animation: countdownTo2 1s steps(2) infinite;

/* The only other write up I could find was at and shamefully missing its images:

Seriously not much is written about these.

I'm off to update all my walkcycle animations because they are missing a frame. Ta! */