cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

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-write -->
<section class="example-cntr read-write">
    <h1>CSS <code>:read-write</code> pseudo-class</h1>
    <p>The <code>:read-write</code> pseudo-class targets elements that <span class="underline">can</span> be edited by the user. It can work on elements that have the <code>contenteditable</code> HTML attribute as well.</p>
    <p>This pseudo-class can be combined with the <code>:focus</code> pseudo-class to enhance the UX under particular situations.</p>
    <p>In the following example, this DIV <span class="underline">can</span> be edited in the browser by clicking on it. Since this piece of content is editable by the user the UX can be enhanced by applying a particular styling that will differentiate it
        from the rest of the content and provide a visual cue to the user that the content can be edited:</p>
    <div class="editable" contenteditable>
        <h1>Click on this text to edit it</h1>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad quod ducimus corporis iusto, ratione pariatur!</p>
    </div>
</section>
            
          
!
            
              //:read-write
.read-write {
    .editable {
        padding: 40px;
        font: 22px Garamond;
        color: lighten($g,30);
        outline: 1px transparent dashed;
        transition: .6s;
        &:read-write:focus {
            outline-color: white;
            font-style: italic;
        }
    }
    h1 { text-align: left; }
}


//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; }
.example-cntr {
    max-width: 800px;
    margin: 0 auto 50px;
    padding: 30px;
    box-shadow: 0 1px 2px rgba(black,.3);
    background: rgba(black,.15);
    & > code {
        display: block;
        margin-bottom: 10px;
        font-size: 22px;
        color: $y;
        background: none;
        box-shadow: none;
    }
    & > h1 {
         text-align: center;
    }
}
.flex-ctnr {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}
small {
    display: block;
    margin: 20px 0 10px;
    padding-top: 10px;    
    text-align: center;
}
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
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