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

              
                .container
    input(type="checkbox" id="switch")
    .ellipse
    .ray
    .head
    .neck
    .body
        label(for="switch")

.container
    .msg.msg_1 404
    .msg.msg_2 Page Not Found
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Fjalla+One);
$black:  #000;
$white:  rgb(255, 254, 226);
$l-grey: rgb(141, 142, 126);
$grey:   rgb(100, 100, 100);
$d-grey: rgb(51, 51, 51);
$yellow: rgb(255, 171, 43);
$time: 9s;

$c-width: 36vmin;
$c-height: 90vmin;

@mixin animation($name) {
    @-webkit-keyframes #{$name} {@content;}
    @-moz-keyframes #{$name} {@content;}
    @-o-keyframes #{$name} {@content;}
    @keyframes #{$name} {@content;}
}

@mixin animation-use($name) {
    -webkit-animation: $name $time infinite linear;
    -moz-animation: $name $time infinite linear;
    -o-animation: $name $time infinite linear;
    animation: $name $time infinite linear;
}

@mixin rotate($val) {
    -webkit-transform: rotate($val);
    -ms-transform: rotate($val);
    transform: rotate($val);
}

@include animation(rotate) {
    25% {
        @include rotate(-28deg);
    }
    75% {
        @include rotate(28deg);
    }
}

@mixin message($val) {
    @include animation(msg_ + $val) {
        0%, 25%, 75.001%, 100% {
            @if ($val == 'first') {
                opacity: 1;
            } @else {
                opacity: 0;
            }
        }
    
        25.001%, 75% {
            @if ($val == 'first') {
                opacity: 0;
            } @else {
                opacity: 1;
            }
        }
    }
}

@include message('first');
@include message('second');
 
body {
    margin: 0;
    overflow: hidden;
    background: $black;
    
    .container {
        position: absolute;
        left: 50%;
        top: 50%;
        width: $c-width;
        height: .866*$c-height;
        margin-left: -$c-width/2;
        margin-top: -.433*$c-height;
        
        &:first-child {
            transform-origin: 50% 100%;
            @include animation-use(rotate);
        }
        
        &:last-of-type {
            pointer-events: none;
        }
        
        #switch {
            display: none;
            
            &:checked ~ .ellipse,
            &:checked ~ .ray {
                opacity: 0;
            }
        }
        
        .ellipse {
            position: relative;
            width: $c-width;
            height: .75*$c-width;
            background: $white;
            border-radius: 50%;
            z-index: 1;
        }
        
        .ray {
            position: relative;
            border-top: .4*$c-height solid $l-grey;
	        border-left: .13*$c-height solid transparent;
	        border-right: .13*$c-height solid transparent;
            margin-top: -.14*$c-height;
        }
        
        .head {
            position: relative;
            width: .4*$c-width;
            height: .02*$c-height;
            margin-left: .3*$c-width;
            background: $yellow;
        }
        
        .neck {
            position: relative;
	        width: .205*$c-width;
            margin-left: .3*$c-width;
	        border-top: .12*$c-width solid $d-grey;
	        border-left: .1*$c-width solid transparent;
	        border-right: .1*$c-width solid transparent;
        }
        
        .body {
            position: relative;
            width: .203*$c-width;
            margin-left: .4*$c-width;
            height: .24*$c-height;
            background: $grey;
        }
        
        label {
            position: absolute;
            top: .04*$c-height;
            left: .073*$c-width;
            width: .04*$c-width;
            height: .04*$c-height;
            border: .012*$c-width solid $d-grey;
            background: $yellow;
            border-radius: 10px;
            cursor: pointer;
        }
    }
    
    .msg {
        position: absolute;
        width: $c-width;
        margin-left: -$c-width/2;
        left: 50%;
        text-align: center;
        font-family: 'Fjalla One', sans-serif;
        color: $black;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        z-index: 2;
        
        &.msg_1 {
            top: .07*$c-height;
            font-size: 12vmin;
            @include animation-use(msg_first);
        }
        
        &.msg_2 {
            top: .12*$c-height;
            font-size: 4.2vmin;
            @include animation-use(msg_second);
        }
    }
}
              
            
!

JS

              
                
              
            
!
999px

Console