Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

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.


Hey! Read this first!

Just to let you know, this Pen was made in 2014!

It's been a while, and a lot has changed on the web.

As cool as this solution is, you might want to do your own
research into the accessibility of this "checkbox hack".

So take it with a pinch of salt, maybe treat it as an
object in the museum of the history of the web, and above
all else, make sure your websites are accessible!

Here's some recommended reading on the subject:

<input id="toggler" class="modal-toggler" type="checkbox" aria-hidden="true">
<section class="modal-container">
  <label for="toggler" class="modal  close-modal-area"></label>
  <div class="modal  modal-box">
    <h1>Modal Container without JS</h1>
    <label for="toggler" class="toggle-modal-button">Close</label>
<section class="content">
  <label for="toggler" class="toggle-modal-button">Show the Modal</label>
  <p><strong>Hey! Be warned!</strong></p>
  <p>This was built in 2014 as a proof-of-concept and isn't very accessible! Seriously, try using your keyboard. This is kind of terrible, and I wish I had never made it and enabled this dark pattern to proliferate.</p>
  <p>So you probably shouldn’t use this.</p>
  <p>We can build much better and accessible interfaces with the web available to us today. Check out the <a href=""><code>popover</code> attribute</a> or the <a href=""><code>&lt;dialog&gt;</code> element</a>!</p>
  <p>This Pen still exists purely as an artifact from the history of the web.</p>
  <p>Read more:</p>
    <li><a href=""><q>CSS-only widgets are inaccessible</q> by Adrian Roselli</a></li>
    <li><a href=""><q>Dialogs and popovers seem similar. How are they different?</q> by Hidde de Vries</a></li>


                [aria-hidden="true"] {
  display: none;

.modal-container {
  background: rgba(black, 0.75);
  opacity: 0;
  color: white;
  width:  100%;
  height: 100%;
  position: fixed;
  top:  0;
  left: 0;
  visibility: hidden;
  transition: opacity  0.5s,
              visibility 0s linear 0.5s;
  z-index: 2;
  .modal-toggler:checked + & {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s;

.modal {
  position: absolute;
  top:  50%;
  left: 50%;
  padding: 2em;
  border-radius: 0.5em;
  transform: translateX(-50%) translateY(-50%);
  &.close-modal-area {
    width:  100%;
    height: 100%;
  &.modal-box {
    background: black;
    text-align: center;
  .content & {
    width: 100%;
    max-width: 40em;

.toggle-modal-button {
  background-color: transparent;
  color: white;
  display: inline-block;
  padding: 1em;
  cursor: pointer;
  border-radius: 0.5em;
  box-shadow: inset 0 0 1px black;
  transition: background-color 0.2s,
              color            0.2s,
              transform        0.1s linear;
  &:active {
    background-color: rgba(black, 0.25);
    box-shadow: none;
    transition: background-color 0.2s,
                color            0.2s,
                box-shadow       0.2s,
                transform        0.1s linear;
  &:active {
    transform: scale(1.2);
  .content & {
    color: rgba(black, 0.75);
    margin-bottom: 1em;

.content {
  color: black;
  width: 90%;
  max-width: 600px;
  padding-top: 2em;
  margin: 0 auto;
  & > * {
    margin-top: 1em;

html {
  box-sizing: border-box;
*, *::before, *::after {
  box-sizing: inherit;

body {
  background-color: mistyrose;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  font-weight: 400;

h1 {
  line-height: 1;

p {
  margin: 0;
  line-height: 2;