cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              <!-- :valid -->
<section class="example-cntr validation valid">
    <h1>CSS <code>:valid</code> pseudo-class</h1>
    <p>The <code>:valid</code> pseudo-class targets form elements whose formatting is correct according to that element’s required format.</p>
    <p>In the following example, when the email input field has an email structure formatted correctly, the field it’s considered “valid” and a <span class="green">green</span> border appears around the input.</p>
    <p><em><span class="underline">Note:</span> In its default state, the field is considered valid. Not sure about you, but to me that feels counterintuitive :p</em></p>
    <label>
        <span>Email:</span>
        <input type="email" id="email" placeholder="name@domain.com">
    </label>
</section>

<!-- :invalid -->
<section class="example-cntr validation invalid">
    <h1>CSS <code>:invalid</code> pseudo-class</h1>
    <p>The <code>:invalid</code> pseudo-class targets form elements whose formatting isn’t correct according to that element’s required format.</p>
    <p>In the following example, when the email input field has an incorrectly formatted email structure it’s automatically invalid and a <span class="red">red</span> border appears around the input.</p>
    <label>
        <span>Email:</span>
        <input type="email" id="email" placeholder="name@domain.com">
    </label>
</section>

            
          
!
            
              //'validations' generic styles
.validation {
    input[type=email] {
        box-sizing: content-box;
        width: 200px;
        padding: 0 5px;
        border: #666 5px solid;
        border-radius: 2px;
        cursor: text;
        transition: .5s;
    }
    label { display: inline-block; }
    span {
        display: block;
        margin-bottom: 5px;
    }
}

//:valid
.valid {
    input[type=email]:valid { border-color: $g; }
}
//:invalid
.invalid {
    input[type=email]:invalid { border-color: $r; }
}



//Styling stuff not needed for demo
body {
    text-align: left;
    line-height: 1.5;
}
h1 {
    font-size: 24px;
    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 {
    width: 30px; height: 30px;
    vertical-align: middle;
    outline: none;
}
input, label { cursor: pointer; }
input[type=text],
input[type=email] { width: 100%; }

label {
    padding: 3px 8px 5px;
    border-radius: 2px;
    border: transparent 1px solid;    
    transition: .5s;
    &:hover {
        border: rgba(white,.2) 1px solid;        
    }
}
.example-cntr {
    max-width: 800px;
    margin: 0 auto 50px;
    padding: 30px;
    box-shadow: 0 1px 2px rgba(black,.3);
    background: rgba(black,.15);
}
.flex-ctnr {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

span {
    &.red,
    &.green,
    &.yellow {
        display: inline-block;
        font-weight: bold;
        font-size: 18px;
        text-shadow: 0 1px 0 #000;
    }
}
.underline { text-decoration: underline; }
.red { color: $r; }
.green { color: $g; }
.yellow { color: $y; }
            
          
!
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