Pen Settings



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


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.


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.


                <!-- :enabled -->
<section class="example-cntr enabled">
    <h1>CSS <code>:enabled</code> pseudo-class</h1>
    <p>All form elements are enabled by default, that is, until we add the attribute <code>disabled</code> to the element in the markup.</p>
    <p>Using a combination of <code>:enabled</code> and <code>:disabled</code> we can improve the UX with visual feedback.</p>
    <section class="notes">
            <li>Press the “Run” button on top to reset the inputs. Refresh browser too</li>
            <li>The labels turn on hover, but that’s only for demostration purposes :]</li>
    <div class="flex-ctnr">
        <label class="control">
            <h4>Click to enable form elements:</h4>
            <button class="toggle"></button>
            <h3>Text Field</h3>
            <input type="text" disabled>
            <h3>Radio Button</h3>
            <input type="radio" disabled>
            <h3>Check Box</h3>
            <input type="checkbox" disabled>
            <h3>Text Area</h3>
            <textarea cols="30" rows="10" disabled></textarea>


.enabled > div {
    text-align: center;    
    &.flex-ctnr > div {
        flex: 1 1 auto;
        margin: 0 1%;
        padding-bottom: 30px;
        position: relative;
    *[disabled] { opacity: .2; }
    .control {
        display: flex;
        flex-basis: 150px;
        align-self: center;
        align-items: center;
        height: 0;
        padding: 50px 10px;
        border: #333 1px solid;
        border-radius: 5px;
        background: linear-gradient($g,darken($g,20) 90%);
        &:hover {
            border-color: #666;
            background: darken($g,20);
        h4 { margin: 0; }
        .toggle { display: none; }

/** Rotating status bars **/

$status-bar-width: 100%;
$status-bar-height: 30px;

/* Container box to set the sides relative to */
.status-bar {
    width: $status-bar-width;
    height: $status-bar-height;    
    transition: all .2s ease;
    transform-style: preserve-3d;
    /* The lower the number the more pronounced the perspective */
    perspective: 20000px;
    /* Rotate the status bar */
    &:hover { transform: rotateX(-89deg); }
    /* Just in case you want to see the status bar rotate :) */
    &.rotate { transform: rotateX(-89deg); }

/* The two faces of the status-bar */
.enabled-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: $status-bar-height;
    font-size: 13px;
    color: white;

/* Style the sides */
.disabled-state {
    transform: translateZ($status-bar-height/2);
    background: rgba(black,.3);
.enabled-state {
    transform: rotateX(90deg) translateZ($status-bar-height*1.5);
    background: $g;

//Styling stuff not needed for demo
body { text-align: left; }
.example-cntr {
    max-width: 1200px;
    margin: auto;
    padding: 20px 50px;    
    box-shadow: 0 1px 2px rgba(black,.3);
    background: rgba(black,.15);    
h1 {
    text-transform: none;
    border-bottom: #636363 1px dotted;
    code {
        display: inline-block;
        margin-bottom: 10px;
        color: $y;
        background: none;
        box-shadow: none;
code { font-size: 1em; }

input {
    display: inline-block;
    width: 30px; height: 30px;
    margin-bottom: 5px;
    vertical-align: middle;
    outline: none;
    font-size: 18px;
input, label { cursor: pointer; }
input[type=email] { width: 100%; height: 30px; }
textarea {
    width: 100%;
    height: 50px;
label {
    padding: 3px 8px 5px;
    border-radius: 2px;
    border: transparent 1px solid;    
    transition: .5s;
    &:hover {
        border: rgba(white,.2) 1px solid;        
h3 {
    font-family: Georgia;
    font-style: italic;
.example-cntr {
    margin-bottom: 50px;
    padding: 10px;    
    box-shadow: 0 1px 2px rgba(black,.3);
    background: rgba(black,.15);
.flex-ctnr {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
small {
    display: block;
    margin: 20px 0 10px;
    padding-top: 10px;    
    text-align: center;
.notes {
    display: table;
    margin: auto;
    padding: 10px 30px;
    background: rgba(lighten($y,10),.1);



                //Toggle disabled/enabled attributes

//Add the labels under the fields on page load
$(".enabled input, .enabled textarea").not(".toggle").after("<div class='status-bar'> <div class='disabled-state'>Option disabled :(</div> <div class='enabled-state'>Option enabled! :}</div> </div>");

//Click the button to add classes and trigger CSS animations
$(".toggle").one("click", function(){
    //Add class .rotate to the message
    //Remove the attribute 'disabled'
    $(this).parents().find("input, textarea").not(".toggle").toggleAttr("disabled");

//toggleAttr() jQuery plugin -
jQuery.fn.toggleAttr = function(attr) {
 return this.each(function() {
  var $this = $(this);
  $this.attr(attr) ? $this.removeAttr(attr) : $this.attr(attr, attr);