cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <!-- :in-range -->
<section class="example-cntr ranges in-range">
    <h1>CSS <code>:in-range</code> pseudo-class</h1>
    <p>The <code>:in-range</code> pseudo-class targets elements that use a range and that the values are within the defined range.</p>
    <p>In the input below, the range is between 5 and 10: Values inside this range create a <span class="green">green</span> border.</p>
    <p>Type <em>555</em> and border color turns red. Type <em>8</em> and border color turns green.</p>
    <input type="number" min="5" max="10">
    <small><em>Press <code>TAB</code> if border color doesn't change when typing.</em></small>
</section>

<!-- :out-of-range -->
<section class="example-cntr ranges out-of-range">
    <h1>CSS <code>:out-of-range</code> pseudo-class</h1>  
    <p>The <code>:out-of-range</code> pseudo-class targets elements that use a range and that the values fall outside the defined range.</p>    
    <p>In the input below, the range is between 5 and 10: Values outside this range create a <span class="red">red</span> border.</p>
    <p>Type <em>555</em> and border color turns red. Type <em>8</em> and border color turns green.</p>
    <input type="number" min="5" max="10">
    <small><em>Press <code>TAB</code> if border color doesn't change when typing.</em></small>
</section>
            
          
!
            
              //'ranges' generic styles
.ranges {
    input[type=number] {
        box-sizing: content-box;
        width: 80px; height: 40px;
        padding: 4px;        
        border-radius: 3px;
        font-size: 22px;
        cursor: text;
        transition: .5s;
    }    
}

//:in-range
.in-range {
    input[type=number] {
        border: 5px solid $r;
    }    
    input[type=number]:in-range {
        border: 5px solid $g;
    }    
}

//:out-of-range
.out-of-range {
    input[type=number] {
        border: 5px solid $g;
    } 
    input[type=number]:out-of-range {
        border: 5px solid $r;
    }
}


//Styling stuff not needed for demo
body { text-align: left; }
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; }
.example-cntr {
    max-width: 800px;
    margin: 0 auto 50px;
    padding: 30px;
    box-shadow: 0 1px 2px rgba(black,.3);
    background: rgba(black,.15);
    &:last-of-type { margin-bottom: 0; }
}

.flex-ctnr {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}
small {
    display: block;
    margin: 20px 0 10px;
    padding-top: 10px;    
    text-align: center;
}

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console