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

              
                .container
	.sub-cont
		-for( i = 0; i < 5; i++ )
			span

footer
	|For more pen 
	a(href="https://codepen.io/wall-e", target="_blank")
		|click here
              
            
!

CSS

              
                /* 24 movements total */
/*	default position
*		1
*		2	3	4	5
*/

$col-yellow: #FFC60B;
$col-orange: #F15A22;
$col-teal: #B2D235;
$col-violet: #AB4A9C;
$col-pink: #ED1164;
$box-size: 3em;

@mixin transform-prefixed($val) {
    -webkit-transform: $val;
    -moz-transform: $val;
    -ms-transform: $val;
    -o-transform: $val;
    transform: $val;
}

@mixin go-animation-prefixed($go-anm) {
    -webkit-animation: $go-anm 5s infinite linear;
    -moz-animation: $go-anm 5s infinite linear;
    -ms-animation: $go-anm 5s infinite linear;
    -o-animation: $go-anm 5s infinite linear;
    animation: $go-anm 5s infinite linear;
}

body{
    background: #E6E7E8;
}
.container{
    margin-top: -1.5em;
    position: absolute;
    left: 50%;
    top: 50%;
    @include transform-prefixed(translate(-50%,-50%));
}
.sub-cont{
    width: 12em;
    position: relative;
}
footer{
    color: red;
    padding-bottom: 15px;
    text-align: center;
    position: absolute;
    bottom: 0;
    left: 50%;
    @include transform-prefixed(translateX(-50%));
}
a{
    color: #000
}
span{
    display: inline-block;
    height: $box-size;
    width: $box-size;
    position: absolute;
    top: 0;
    text-align: center;
    border-radius: 8px;
    border: 1px solid #a9a9a9
}

/* for understanding the code write 1,2,3... inside span */
span:nth-child(1){
    background-color: $col-yellow;
    top: -3.5em;
    left: 0;
}
span:nth-child(2){
    background-color: $col-orange;
    left: 0;
}
span:nth-child(3){
    background-color: $col-teal;
    left: 3.5em;
}
span:nth-child(4){
    background-color: $col-violet;
    left: 7em;
}
span:nth-child(5){
    background-color: $col-pink;
    left: 10.5em;
}

@for $i from 1 through 5 {
    span:nth-child(#{$i}) {
        @include go-animation-prefixed(go-#{$i});
    }
}

@keyframes go-1 {
    0%,100% {	/* initial position */
        left: 0;
        top: -3.5em;
        background-color: $col-yellow;
    }
    4.17%,50% {	/* slides to position 2 */
        left: 0;
        top: 0;
        background-color: $col-orange;
    }
    54.17%{	/* slides under pos 2 */
        left: 0;
        top: 3.5em;
        background-color: $col-yellow;
    }
    58.33%{	/* slides under pos-3 */
        left: 3.5em;
        top: 3.5em;
        background-color: $col-yellow;
    }
    62.5%,91.67%{	/* slides to pos-3 */
        left: 3.5em;
        top: 0;
        background-color: $col-teal;
    }
    95.83%{	/* slides above 3 */
        left: 3.5em;
        top: -3.5em;
        background-color: $col-yellow;
    }
}
@keyframes go-2 {
    0%,54.17%,100% { /* ini pos */
        left: 0;
        top: 0;
        background-color: $col-orange;
    }
    4.17%{	/* slides under 2 */
        left: 0;
        top: 3.5em;
        background-color: $col-yellow;
    }
    8.33%{	/* slides under 3 */
        left: 3.5em;
        top: 3.5em;
        background-color: $col-yellow;
    }
    12.5%,41.67% {	/* slides to 3 */
        left: 3.5em;
        top: 0;
        background-color: $col-teal;
    }
    45.83%{	/* slides above 3 */
        left: 3.5em;
        top: -3.5em;
        background-color: $col-yellow;
    }
    50%{	/* slides above 2 */
        left: 0;
        top: -3.5em;
        background-color: $col-yellow;
    }
}
@keyframes go-3 {
    8.33%,45.83%,58.33%,95.83%,100%{	/* ini pos */
        left: 3.5em;
        top: 0;
        background-color: $col-teal;
    }
    12.5%,62.5%{	/* slides above 3 */
        left: 3.5em;
        top: -3.5em;
        background-color: $col-yellow;
    }
    16.67%,66.67%{	/* slider above 4 */
        left: 7em;
        top: -3.5em;
        background-color: $col-yellow;
    }
    20.83%,33.33%,70.85%,83.33% {	/* slides to 4 */
        left: 7em;
        top: 0;
        background-color: $col-violet;
    }
    37.5%,87.5%{	/* slides under 4 */
        left: 7em;
        top: 3.5em;
        background-color: $col-yellow;
    }
    41.67%,91.67%{	/* slides under 3 */
        left: 3.5em;
        top: 3.5em;
        background-color: $col-yellow;
    }
}
@keyframes go-4 {
    16.67%,87.5%,100%{	/* ini pos */
        left: 7em;
        top: 0;
        background-color: $col-violet;
    }
    20.83%{	/* slides under 4 */
        left: 7em;
        top: 3.5em;
        background-color: $col-yellow;
    }
    25%{	/* slides under 5 */
        left: 10.5em;
        top: 3.5em;
        background-color: $col-yellow;
    }
    29.17%,75%{	/* slides to 5 */
        left: 10.5em;
        top: 0;
        background-color: $col-pink;
    }
    79.17%{	/* slides above 5 */
        left: 10.5em;
        top: -3.5em;
        background-color: $col-yellow;
    }
    83.33%{	/* slides above 4 */
        left: 7em;
        top: -3.5em;
        background-color: $col-yellow;
    }
}
@keyframes go-5 {
    25%,100% {	/* ini pos */
        left: 10.5em;
        top: 0;
        background-color: $col-pink;
    }
    29.17%{	/* slides above 5 */
        left: 10.5em;
        top: -3.5em;
        background-color: $col-yellow;
    }
    33.33%{	/* slides above 4 */
        left: 7em;
        top: -3.5em;
        background-color: $col-yellow;
    }
    37.5%, 66.67%{	/* slides to 4 */
        left: 7em;
        top: 0;
        background-color: $col-violet;
    }
    70.85%{	/* slides under 4 */
        left: 7em;
        top: 3.5em;
        background-color: $col-yellow;
    }
    75%{	/* slides under 5 */
        left: 10.5em;
        top: 3.5em;
        background-color: $col-yellow;
    }
    79.17%{	/* slides to 5 */
        left: 10.5em;
        top: 0;
        background-color: $col-pink;
    }
}
              
            
!

JS

              
                
              
            
!
999px

Console