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

Quick-add: + add another resource

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.

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.

            
              <div lang="zxx">
  <p class="foo">foo</p>
  <p class="bar">bar</p>
  <p class="baz">baz</p>
  <p class="fum">fum</p>
</div>
<p lang="fr">
  <a href="https://fr.wikipedia.org/wiki/Luminance#Matri.C3.A7age">Luminance et matriçage sur Wikipédia.</a>
</p>
            
          
!
            
              @function bow($color) { // black or white
    @if (0.2126 *   red($color) // https://fr.wikipedia.org/wiki/Luminance#Matri.C3.A7age
       + 0.7152 * green($color)
       + 0.0722 *  blue($color))
       / 255 > 1/2 {
      @return black;
    } @else {
      @return white;
    }
}

//////////////////////////////////////////////////////////////////////

.foo {
  $color: gold;

  background-color: $color;
  color: bow($color);
}

.bar {
  $color: purple;
  
  background-color: $color;
  color: bow($color);
}

.baz {
  $color: orangered;
  
  background-color: $color;
  color: bow($color);
}

.fum {
  $color: gray;
  
  background-color: $color;
  color: bow($color);
}

//////////////////////////////////////////////////////////////////////

@at-root {
  $gutter: (24rem / 16); // 16 * 3/2 = 24px
  
  html {
    background-position: 50% 0;
    background-size: 100% ($gutter * 2),
                          ($gutter * 2) 100%;
    background-image: linear-gradient(
      to bottom,
      transparent,
      transparent 50%,
      transparentize(lightgray, 3/4) 50%,
      transparentize(lightgray, 3/4)
    ), linear-gradient(
      to right,
      transparent,
      transparent 50%,
      transparentize(lightgray, 3/4) 50%,
      transparentize(lightgray, 3/4)
    );
    
    @media not all and // reverse query
           (min-width: ($gutter * 50 / 1rem * 1em)) { // convert rem to em
      background-image: linear-gradient(
        to bottom,
        transparent,
        transparent 50%,
        transparentize(lightgray, 3/4) 50%,
        transparentize(lightgray, 3/4)
      );
    }
  }

  body {
    margin:      $gutter auto;
    padding:   0 $gutter;
    line-height: $gutter;
    width:       $gutter * 50; // 1000px
    max-width: 100%;
    box-sizing: border-box;
  }

  p {
    $color: white;
    
    padding: $gutter;
    margin:  $gutter 0;
    border: 1px solid lightgray;
    position: relative;
    margin-top:  -2px;
    margin-left: -2px;
    top:  1px;
    left: 1px;
    background-color: $color;
    color: bow($color);
    font-weight: bold;
    
    @media not all and // reverse query
           (min-width: ($gutter * 50 / 1rem * 1em)) { // convert rem to em
      text-align: center;
    }
  }

  a {
    color: currentColor;
    display: block;
  }
}
            
          
!
999px
Loading ..................

Console