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

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">
            <a href="#" class="button reflection">Click me</a>
        </div>

        <div class="container">
            <a href="#" class="button rattle">See me!</a>
        </div>

        <div class="container">
            <a href="#" class="button pastel"><span>Color shifter</span></a>
        </div>

        <div class="container">

                <div class="expand">

                    <div class="hide before">
                        <input type="text" placeholder="Name"/>
                        <input type="password" placeholder="Passw"/>
                    </div>
                    <a href="#" class="button action">Login</a>
                    <div class="hide after">
                        <a href="#" class="button cancel">Cancel</a>
                    </div>
                </div>

        </div>
              
            
!

CSS

              
                $blue: #5197d4;
$darkgreen: #6d902f;
$lightgreen: #a4d74a;
$pastel1: #ffc987;
$pastel2: #fdafb0;
$pastel3: #bdf2ff;
$greenish: #00B75E;
$fontsize: 30px;

@import url('https://fonts.googleapis.com/css?family=Overpass:400,600,700,900');
body {
    padding: 0;
    margin: 0;
}
.container {
    display: flex;
    align-items: center;
    min-height: 25vh;
    width: 100vw;
}
.button {
    display: inline-block;
    margin: 1rem auto;
    border: none;
    padding: .65em 1em .5em;
    border-radius: .2em;

    text-decoration: none;
    font-size: $fontsize;
    font-family: "Overpass", sans-serif;
    font-weight: 600;
    letter-spacing: .05em;
    line-height: 1em;
}
.rattle {
    color: lighten($blue,50%);
    background: $blue;
    text-shadow: 0 .05em 0 darken($blue,20%);
    box-shadow: 0 .1em .2em transparentize(darken($blue, 30%), 0.5);

    animation: rattle 5s infinite;
}

.reflection {
    background: linear-gradient(to bottom, $lightgreen 0%, $darkgreen 100%);
    text-shadow: 0 1px 0 rgba(0,0,0,0.3);
    color: #fff;
    position: relative;
    box-shadow: 0 .1em .3em rgba(69,104,7,.75);

    animation: turny 5s ease-in infinite;
    &:before {
        content:'';
        display: block;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background-image: linear-gradient(135deg,
            rgba(255,255,255,0) 0%,
            rgba(255,255,255,0) 45%,
            rgba(255,255,255,0.2) 55%,
            rgba(255,255,255,0) 55%,
            rgba(255,255,255,0) 100%);
        background-size: 400% 400%;
        background-position: right bottom;
        background-repeat: no-repeat;
        animation: reflection 5s ease-in infinite;
    }
}
.pastel {
    color: #fff;
    background-image: radial-gradient(ellipse at center, $pastel1 0%,$pastel2 47%,$pastel3 100%);
    background-size: $fontsize*20 $fontsize*20;
    background-position: left center;

    animation: pastel-background 10s ease-in-out infinite;

    padding: .2em;
    span {
        display: block;
        border-radius: .1em;
        padding: .45em .8em .3em;
        text-shadow: 0 0 .2em #fff;
    }
    &:hover {
        animation: box-glow 10s ease-in-out infinite;
        span {
            background: #fff;
            box-shadow: 0 0 .2em #fff;
            color: $pastel1;
            animation: text-glow 10s ease-in-out infinite;
        }
    }
}

.expand {
    display: inline-block;
    margin: auto;
    height: auto;
    box-sizing: border-box;
    border-radius: .5em;
    position: relative;
    background: $greenish;
    max-width: 12em;

    transition: padding .5s ease-out,
        max-width .25s ease-in;
    text-align: center;

    .hide {
      display: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height .5s ease-in .5s;
    }
    input {
        box-sizing: border-box;
        display: block;
        width: 100%;
        padding: .5em;
        margin: .25em auto;
        background: #eee;
        color: #333;
        border: none;
        font-family: "Overpass", sans-serif;
        font-size: $fontsize;
        &:first-child {
            margin-bottom: .5em;
        }
    }
    .button {
        box-sizing: border-box;
        border: .1em solid $greenish;
        text-align: center;
        margin: 0 auto;
        width: 100%;
        max-width: 6.5em;
        transition: max-width .5s ease-out,
            margin .5s ease-out,
            max-width .5s ease-in;

        &:hover, &:active {
            background: #fff;
            color: $greenish;
            border-color: #fff;
        }
    }
    .action {
        background: $greenish;
        color: #fff;
        white-space: nowrap;
        &:hover, &:active {
            border-color: $greenish;
        }
    }
    .cancel {
        background: $greenish;
        color: #fff;
        border-color: #fff;
    }

    &.active {
        padding: 3em;
        max-width: 30em;
        .hide {
            max-height: 20em;
        }
        .button {
            max-width: 30em;

            margin: .25em auto;
        }
        .action {
            background: #fff;
            color: $greenish;
            border-color: #fff;
        }
    }
}

@keyframes rattle {
    0% {
            transform: rotateZ(0) scale(1);
    }
    94% {
            transform: rotateZ(0) scale(1);
            box-shadow: 0 .1em .2em transparentize(darken($blue, 30%), 0.5);
    }
    95% {
            transform: rotateZ(2deg) scale(1.1);
            box-shadow: 0 .1em .5em transparentize(darken($blue, 20%), 0.5);
    }
    97% {
            transform: rotateZ(-2deg) scale(1.1);
    }
    99% {
            transform: rotateZ(2deg) scale(1.1);
            box-shadow: 0 .1em .5em transparentize(darken($blue, 20%), 0.5);
    }
    100% {
            transform: rotateZ(0) scale(1);
            box-shadow: 0 .1em .2em transparentize(darken($blue, 30%), 0.5);
    }
}
@keyframes reflection {
  0% {
    background-position: right bottom;
  }
  40% {
    background-position: right bottom;
  }
  60% {
    background-position: left top;
  }
  100% {
    background-position: left top;
  }
}
@keyframes turny {
  0% {
    transform: rotateY(0);
  }
  42% {
    transform: rotateY(0);
  }
  45% {
    transform: rotateY(20deg);
  }
  55% {
    transform: rotateY(-5deg);
  }
  57% {
    transform: rotateY(0);
  }
  100% {
    transform: rotateY(0);
  }
}
@keyframes pastel-background {
    0% {
        background-position: 0% 50%;
    }
    33% {
        background-position: 75% 100%;
    }
    66% {
        background-position: 100% 0%;
    }
    100% {
        background-position: 0% 50%;
    }
}
@keyframes text-glow {
    0% {
        color: $pastel1;
        text-shadow: 0 0 .2em $pastel1;
    }
    33% {
        color: $pastel2;
        text-shadow: 0 0 .2em $pastel2;
    }
    66% {
        color: $pastel3;
        text-shadow: 0 0 .2em $pastel3;
    }
    100% {
        color: $pastel1;
        text-shadow: 0 0 .2em $pastel1;
    }
}
@keyframes box-glow {
    0% {
        box-shadow: 0 0 .4em $pastel1;
    }
    33% {
        box-shadow: 0 0 .4em $pastel2;
    }
    66% {
        box-shadow: 0 0 .4em $pastel3;
    }
    100% {
        box-shadow: 0 0 .4em $pastel1;
    }
}
@keyframes show-controls {
    0% {
        max-height: 0;
    }
    100% {
        max-height: 10em;
    }
}
@keyframes hide-controls {
    0% {
        max-height: 10em;
    }
    100% {
        max-height: 0;
    }
}

              
            
!

JS

              
                $(document).ready(function() {

    $(".action, .cancel").click(function (e) {
       e.preventDefault(); $(".expand").toggleClass("active");
    });
});

              
            
!
999px

Console