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.

              <input id="button" class="button__check" type='checkbox'>
<label for="button" class="button__label" onclick></label>
<div class="target">
  <div class="box one"></div>
  <div class="box two"></div>
              @import url(https://fonts.googleapis.com/css?family=Montserrat);

.button__check {
  /* Hide the checkbox from view */
  position: absolute;
  left: -999em;
.button__label {
  display: inline-block;
  font-family: Tahoma, sans-serif;
  border:1px solid #777;
  border-radius: 3px;
  background: #944;
  padding: 10px;
  cursor: pointer;
  width: 180px;
  text-align: center;
  transition: background 0.5s ease-in-out;
  margin-bottom: 15px;

.target {
  width: 300px;
  height: 300px;
  background: #444;
  border: 1px solid #666;
  position: relative;

.box {
  position: absolute;
  width: 100px;
  height: 100px;
  background: #444;
  border:1px solid #666;
  transition: all 0.85s ease-in-out;

.box.one {
  left: 40px;
  top: 40px;

.box.two {
  right: 40px;
  bottom: 40px;

/* Apply an animated state to the .box elements
when they are within a sibling of a checked .button__check
NOTE: you _must_ include the siblig .target in the selector */
.button__check:checked ~ .target .box {
  background: #6F6;
  transform: scale(1.25, 1.25) rotate(45deg);

/* This "adjacent sibling" rule matches all divs with class .target _only when_ they are siblings of a checked checkbox with class = "button__check" */
.button__check:checked ~ .target {
  background: #DDD;
  border: 1px solid #888;

/* Style and content for the label when "on" */
.button__check:checked ~ label {
  background: #494;

.button__check:checked ~ label:after {
  content: "Button On";

/* Style and content for the label when "off" */
.button__check:not(:checked) ~ label:after {
  content: "Button Off";
Loading ..................