cssAudio - Activefile-genericCSS - 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.

            
              <!-- :read-only -->
<section class="example-cntr read-only">
    <h1>CSS <code>:read-only</code> pseudo-class</h1>
    <p>The <code>:read-only</code> pseudo-class targets an element that cannot be editable by the user. This pseudo-class is very similar to the <code>:disabled</code> pseudo-class, it all depends on which attribute is used in the markup that would tell
        us which pseudo-class to use.</p>
    <p>This is useful for example in situations where we need to show prepopulated information on a form that cannot be altered but that still needs to be displayed in form elements for submission purposes.</p>
    <p>In the following example, this input has the <code>readonly</code> HTML attribute, so it will have gray text, and thus we can target it with the <code>:read-only</code> pseudo-class.</p>
    <label>
        <span>Are you read-only?</span>
        <input type="text" value="Yep! I am read only" readonly>
    </label>
</section>
            
          
!
            
              //:read-only
.read-only {    
    input[type=text] {
        box-sizing: content-box;
        width: 200px;
        padding: 0 5px;
        border: #666 2px solid;
        border-radius: 2px;
        box-shadow: inset 0 -1px 0 #fff, inset -1px 0 0 #fff;
        cursor: text;
        transition: .5s;
    }
    input[type=text]:read-only {
        color: #555;
        text-shadow: 0px -1px 0 #f9f9f9;
        background: #cdcdcd;
    }
    label { display: inline-block; }
    span {
        display: block;
        margin-bottom: 5px;
    }
}



//Styling stuff not needed for demo
body {
    text-align: left;
    line-height: 1.5;
}
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=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);
}
            
          
!
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