Pen Settings

HTML

CSS

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.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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.

+ add another resource

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h2>Which of these is the lighest?</h2>
<p>Below are 4 swatches of background colors with some black text placed over them. Which of the following is lightest? We clearly perceive them as very different.  While human beings perceive the lightness of the background (and thus the contrast as well) very different in these, each has the same 'lightness' (40%)
  in hsl...</p>

<table>
  <tr>
    <th>
      hsl(120, 0%, 40%)
    </th>
    <th>
      hsl(120, 100%, 40%)
    </th>
    <th>
      hsl(220, 100%, 40%)
    </th>
    <th>
      hsl(320, 100%, 40%)
    </th>
  </tr>
  <tr>
    <td>
      <svg viewBox="0 0 100 100">
       <circle style="fill: hsl(120, 0%, 40%)" cx="50" cy="50" r="50" />
       <text x="43%" y="60%" class="small">A</text>
     </svg>
    </td>
    <td>
      <svg viewBox="0 0 100 100">
       <circle style="fill: hsl(120, 100%, 40%)" cx="50" cy="50" r="50" />
       <text x="43%" y="60%" class="small">A</text>
     </svg>
    </td>
    <td>
      <svg viewBox="0 0 100 100">
       <circle style="fill: hsl(220, 100%, 40%)" cx="50" cy="50" r="50" />
       <text x="43%" y="60%" class="small">A</text>
     </svg>
    </td>
    <td>
      <svg viewBox="0 0 100 100">
       <circle style="fill: hsl(320, 100%, 40%)" cx="50" cy="50" r="50" />
       <text x="43%" y="60%" class="small">A</text>
     </svg>
    </td>
  </tr>
</table>

<h2>Ratios of difference</h2>
<p>Similarly, you might think of rgb as measuring the amount 'light' of each channel, so it might seem light we could somehow reason about that consistently.  However,  each of the following contain 20% of two colors, and 100% of another - and we perceive their respective lightness very differently.</p>

<table>
  <tr>
    <th>
      rgb(100%, 20%, 20%)
    </th>
    <th>
      rgb(20%, 100%, 20%)
    </th>
    <th>
      rgb(20%, 20%, 100%)
    </th>
  </tr>
  <tr>
    <td>
      <svg viewBox="0 0 100 100">
       <circle style="fill: rgb(100%, 20%, 20%)" cx="50" cy="50" r="50" />
       <text x="43%" y="60%" class="small">A</text>
     </svg>
    </td>
    <td>
      <svg viewBox="0 0 100 100">
       <circle style="fill: rgb(20%, 100%, 20%)" cx="50" cy="50" r="50" />
       <text x="43%" y="60%" class="small">A</text>
     </svg>
    </td>
    
    <td>
      <svg viewBox="0 0 100 100">
       <circle style="fill: rgb(20%, 20%, 100%)" cx="50" cy="50" r="50" />
       <text x="43%" y="60%" class="small">A</text>
     </svg>
    </td>
  </tr>
</table>

<p>The same holds true of progressive 'steps'. The 'difference' between the two pairs are equal - that is, from the first cirlce to the second (A) represent a 'step' of 20% difference in 2 channels - it is hardly perceivable.  The third and fourth circles (B) also differ by 20%, but this is very perceivable.</p>


<table>
  <tr>
    <th>
      rgb(20%, 100%, 20%)
    </th>
    <th>
      rgb(40%, 100% 40%)
    </th>
    <th>
      rgb(100%, 60%, 60%)
    </th>
    <th>
      rgb(100%, 80%, 80%)
    </th>
  </tr>
  <tr>
    <td>
      <svg viewBox="0 0 100 100">
       <circle style="fill: rgb(20%, 100%, 20%)" cx="50" cy="50" r="50" />
       <text x="43%" y="60%" class="small">A</text>
     </svg>
    </td>
    <td>
      <svg viewBox="0 0 100 100">
       <circle style="fill: rgb(40%, 100%, 40%)" cx="50" cy="50" r="50" />
       <text x="43%" y="60%" class="small">A</text>
     </svg>
    </td>
    <td>
      <svg viewBox="0 0 100 100">
       <circle style="fill: rgb(100%, 60%, 60%)" cx="50" cy="50" r="50" />
       <text x="43%" y="60%" class="small">B</text>
     </svg>
    </td>
    <td>
      <svg viewBox="0 0 100 100">
       <circle style="fill: rgb(100%, 80%, 80%)" cx="50" cy="50" r="50" />
       <text x="43%" y="60%" class="small">B</text>
     </svg>
    </td>
  </tr>
</table>

              
            
!

CSS

              
                table {
  width: 80%;
  margin: auto;
}
td {
  padding: 0 4px;
}
th {
  font-weight: normal;
  font-style: italic;
}

@media (min-width: 800px) { 
  td { 
    width: 25%;
    padding: 0 5px;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console