css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
                      <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>
            
          
!
            
              $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;
    }
}

            
          
!
            
              $(document).ready(function() {

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

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console