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.

              <!-- :required -->
<section class="example-cntr required">    
    <h1>CSS <code>:required</code> pseudo-class</h1>
    <p>The <code>:required</code> pseudo-class targets inputs that have the <code>required</code> HTML attribute.</p>
    <p>Instead of relying on the traditional asterisk * on the labels to denote “required”, we can also style required fields with CSS. Basically, the best of both worlds.</p>
    <p>In the following example, this input has the <code>required</code> HTML attribute. The UX can be enhanced by applying a particular styling to provide a visual cue to the field is, well, required :)</p>
    <p>Try submitting the form without filling any field.</p>
        <small>All fields are <span class="blue">required</span> unless marked as "optional".</small>
            <input type="text" id="name" required>
        <label>Email <small>(optional)</small>:
            <input type="email" id="email">
            <textarea name="comments" id="comments" cols="30" rows="5" required></textarea>
        <button type="submit">Send Comments</button> 
.required {
    form { width: 300px; }
    label {
        display: block;
        margin-bottom: 5px;
    input, textarea {
        height: auto !important;
        margin: 5px 0 !important;
        padding: 5px 5px 5px 10px !important;
        border: none;
        font-size: 18px;
        cursor: text;
    button {
        margin-left: 10px;
        padding: 5px 35px;
        font:bold  1em 'Source Sans Pro', Arial, Helvetica, sans-serif;    
        color: white;
        border: 3px solid rgba(black,.5);
        border-radius: 2px;
        cursor: pointer;
        background: $g;
        transition: .5s;
        &:hover {
           background: darken($g,8);;
    :required {
        box-shadow: inset 5px 0 0 rgba($b,.8);
    .blue {
        display: inline-block;
        padding: 0 5px;
        background: darken($b,20);

//Styling stuff not needed for demo
body { text-align: left; }
h1 {
    font-size: 22px;
    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=email] { width: 100%; }
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;        
.example-cntr {
    max-width: 800px;
    margin: 0 auto 50px;
    padding: 30px;
    box-shadow: 0 1px 2px rgba(black,.3);
    background: rgba(black,.15);
form {
    min-width: 400px;
    padding: 20px;
    border: #444 1px solid;
    border-radius: 2px;
🕑 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.