css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <input type="checkbox" id="toggle" name="toggle" />
<div id="background"></div>
<h1>Theme Toggle</h1>
<h2>#cssonly</h2>
<div class="themes">
  <span>Light</span>
  <label for="toggle"></label>
  <span>Dark</span>
</div>
<p class="about">A #cssonly method to change the look of the whole page. All elements (before or after the toggle) react to the new theme. Even the background adapts to the new theme. It also strecthes to match the content, and to prove it I'll paste lyrics from my
  favourite band to make the page really long.</p>

<h3>Numb - Linkin Park</h3>
<ul>
  <li>I'm tired of being what you want me to be</li>
  <li>Feeling so faithless, lost under the surface</li>
  <li>Don't know what you're expecting of me</li>
  <li>Put under the pressure of walking in your shoes</li>
</ul>
<ul>
  <li>Caught in the undertow</li>
  <li>Just caught in the undertow</li>
  <li>Every step that I take is another mistake to you</li>
  <li>Caught in the undertow</li>
  <li>Just caught in the undertow</li>
</ul>
<ul>
  <li>I've become so numb, I can't feel you there</li>
  <li>Become so tired, so much more aware</li>
  <li>I'm becoming this, all I want to do</li>
  <li>Is be more like me and be less like you!</li>
</ul>
<ul>
  <li>Can't you see that you're smothering me?</li>
  <li>Holding too tightly, afraid to lose control</li>
  <li>'Cause everything that you thought I would be</li>
  <li>Has fallen apart, right in front of you</li>
</ul>
<ul>
  <li>Caught in the undertow</li>
  <li>Just caught in the undertow</li>
  <li>Every step that I take is another mistake to you</li>
  <li>Caught in the undertow</li>
  <li>Just caught in the undertow</li>
  <li>And every second I waste is more than I can take</li>
</ul>
<ul>
  <li>I've become so numb, I can't feel you there</li>
  <li>Become so tired, so much more aware</li>
  <li>I'm becoming this, all I want to do</li>
  <li>Is be more like me and be less like you!</li>
</ul>
<ul>
  <li>And I know I may end up failing, too</li>
  <li>But I know you were just like me</li>
  <li>With someone disappointed in you</li>
</ul>
<ul>
  <li>I've become so numb, I can't feel you there</li>
  <li>Become so tired, so much more aware</li>
  <li>I'm becoming this, all I want to do</li>
  <li>Is be more like me and be less like you!</li>
</ul>
<ul>
  <li>I've become so numb, I can't feel you there</li>
  <li>I'm tired of being what you want me to be</li>
  <li>I've become so numb, I can't feel you there</li>
  <li>I'm tired of being what you want me to be</li>
</ul>

<div class="end">TADA :)</div>
            
          
!
            
              body {
  font-family: "SF Pro Display", "SF Pro Icons", "Helvetica Neue", "Helvetica",
    "Arial", sans-serif;
  font-size: 16px;
  margin: 0;
  padding: 20px 0;
  position: relative;
  text-align: center;
}
#toggle {
  display: none;
}
h1 {
  color: #ff1e2b;
  font-size: 4em;
  margin: 0;
}
h2 {
  font-size: 2em;
  margin: 10px 0 0;
  opacity: 0.6;
}
.themes {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

label {
  background: #cbcbcb;
  border-radius: 40px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: block;
  height: 40px;
  margin: 0 10px;
  outline: 0;
  padding: 2px;
  position: relative;
  transition: all 0.4s ease;
  user-select: none;
  width: 80px;
}
label:after {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
  background: #fbfbfb;
  border-radius: 50%;
  content: "";
  display: block;
  height: 36px;
  left: 4px;
  position: absolute;
  top: 4px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  width: 36px;
}
.about {
  font-size: 1.2em;
  line-height: 1.4em;
  margin: 0 auto 80px;
  max-width: 600px;
  text-align: justify;
}

#background {
  background: url(https://images.unsplash.com/photo-1517607908060-9a66da662869?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=2298f6468e7b5ec2df4355b098a756e6)
    50% 55%;
  bottom: 0;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: -1;
}

ul {
  line-height: 1.3em;
  list-style: none inside;
  margin-bottom: 1em;
  min-width: 500px;
  padding: 0 20px;
}

#toggle:checked ~ h1 {
  color: #fff;
}
#toggle:checked ~ .themes label {
  background: rgba(255, 255, 255, 0.5);
  border-color: #111;
}
#toggle:checked ~ .themes label:after {
  background: #111;
  left: 44px;
}

#toggle:checked ~ #background {
  background: #000 url(https://images.unsplash.com/photo-1484387436194-cf7cb70800ce?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=073c77fe92e53e22ed4a58231a5e0d47);
}
#toggle:checked ~ * {
  color: #fff;
}

.end {
  color: #fff;
  margin-top: 80px;
}

            
          
!
            
              /* I told you there was nothing here :) */

/*  What should I build next? */
/* If you like this pen, drop a comment and let me know what should I code next. A few words or a link are enough. If you think it's interesting, probably I'll feel the same */
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console