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 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.

            
              <!-- :empty -->
<section class="example-cntr empty">
    <h1>CSS <code>:empty</code> pseudo-class</h1>
    <p>The <code>:empty</code> pseudo-class targets elements that have no content of any kind in them, at all.</p>
    <p>If it has any type of character, even a space, then the element is <span class="underline">not</span> considered empty.</p>
    <p>In the following example <span class="red">Red</span> boxes have content and <span class="yellow">Yellow</span> boxes are empty:</p>
    <div class="flex-ctnr">
        <div>I have content, thus I'm red…</div>
        <div> </div> <!-- A space is considered content so it’s red -->
        <div></div> <!-- Totally empty element so it’s yellow -->
        <div><!-- This comment inside isn’t considered content so it’s yellow --></div>
    </div>
</section>
            
          
!
            
              //:empty
.empty {
    .flex-ctnr div {
        display: flex;
        flex: 1;
        justify-content: center;
        align-items: center;
        margin: 0 5px;
        padding: 3px;
        background: $r;
    }
    .flex-ctnr div:empty { background: $y; }  
}


//Styling stuff not needed for demo
body { text-align: left; }
.example-cntr {
    max-width: 800px;
    margin: auto;
    padding: 20px 50px;
    box-shadow: 0 1px 2px rgba(black,.3);
    background: rgba(black,.15);    
}
h1 {
    text-transform: none;
    border-bottom: #636363 1px dotted;
    code {
        display: inline-block;
        margin-bottom: 10px;
        color: $y;
        background: none;
        box-shadow: none;
    }
}
.flex-ctnr {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 20px;
}
code { font-size: 1em; }
.underline { text-decoration: underline; }
$r: lighten($r,12);
.red { color: $r; }
.green { color: $g; }
.yellow { color: $y; }

            
          
!
999px
Loading ..................

Console