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.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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.

            
              <!-- http://adrianroselli.com/2017/05/under-engineered-custom-radio-buttons-and-checkboxen.html -->

<main>
  <h1>Under-Engineered Custom Radio Buttons and Checkboxen</h1>

  <form action="#" autocomplete="off">
    <h2>Please fill out the things.</h2>
     <fieldset>
      <legend>Send Me Spam </legend>
      <div>
        <input type="radio" name="spam" id="spamY" checked> <label for="spamY">Please send me all the spam.</label>
      </div>
      <div>
        <input type="radio" name="spam" id="spamN"> <label for="spamN">Please send it to my neighbor.</label>
      </div>
      <div>
        <input type="radio" name="spam" id="spamX"> <label for="spamX">Here is an option that is probably too long to fit on one line so it is an opportunity to test wrapping.</label>
      </div>
      <div>
        <input type="radio" name="spam" id="spamD" disabled> <label for="spamD">This one is disabled</label>
      </div>
    </fieldset>
    <div>
      <input type="checkbox" name="terms" id="terms"> <label for="terms">I have read your terms and they make no sense.</label>
    </div>
    <div>
      <input type="checkbox" name="freebies" id="freebies" disabled> <label for="freebies">Please send me free things.</label>
    </div>
    <div>
      <input type="checkbox" name="spamAnyway" id="spamAnyway" checked disabled> <label for="spamAnyway">Regardless of my choice above, sign me up for all your physical and electronical spam.</label>
    </div>
    <div>
      <input type="reset" value="Break all my effort.">
      <input type="submit" value="Post this thing">
    </div>
  </form>
  <p>
  For the post <a href="http://adrianroselli.com/2017/05/under-engineered-custom-radio-buttons-and-checkboxen.html"><cite>Under-Engineered Custom Radio Buttons and Checkboxen</cite></a>.
  </p>
</main>

            
          
!
            
              /* http://adrianroselli.com/2017/05/under-engineered-custom-radio-buttons-and-checkboxen.html */

@import url(https://fonts.googleapis.com/css?family=Lato:400,700);

body {
  background-color: #6D695C;
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAACVBMVEUAAAAAAAAAAACDY+nAAAAAA3RSTlMmDQBzGIDBAAAAG0lEQVR42uXIIQEAAADCMHj/0NdkQMws0HEeAqvwAUGJthrXAAAAAElFTkSuQmCC);
  font-size: 100%;
  color: #333;
  font-family: Lato, Arial, sans-serif;
  padding: 0;
  margin: 0;
}

main {
  display: block;
  box-sizing: border-box;
  width: 90%;
  margin: 1em auto;
  padding: 1em 2em;
  color: #000;
  background-color: rgba(204,204,204,.7);
  border: .07em solid rgba(0,0,0,.5);
  border-radius: .5em;
}

/*-- forms --*/

form {
  background-color: #fff;
  padding: 1em 2em;
}

form div {
  box-sizing: border-box;
  position: relative;
}

form > div,
form fieldset > div {
  margin: 1.5em 0;
}

form fieldset > div:first-of-type {
  margin-top: 1em;
}

form fieldset > div:last-of-type {
  margin-bottom: 1em;
}

fieldset {
  border: .1em solid rgba(0, 0, 0, .15);
}

input,
textarea,
select {
  font-size: 100%;
  color: #333;
  font-family: Lato, Arial, sans-serif;
}

input[disabled] + label::after,
input[disabled] + datalist + label::after,
textarea[disabled] + label::after,
select[disabled] + label::after {
  content: " (disabled)";
}

/* Buttons */

input:not([type=radio]):not([type=checkbox])[type=reset] {
  display: none;
}

input:not([type=radio]):not([type=checkbox])[type=submit],
button {
  color: #fff;
  background-color: #00f;
  border: .1em solid #00f;
  border-radius: .2em;
  font-weight: bold;
  padding: .5em;
  text-align: center;
  width: 100%;
  box-shadow: .25em .25em .5em rgba(0, 0, 0, .5);
}

input:not([type=radio]):not([type=checkbox])[type=submit]:focus,
button:focus,
input:not([type=radio]):not([type=checkbox])[type=submit]:hover,
button:hover {
  color: #00f;
  background-color: #fff;
  outline: 0;
}

input:not([type=radio]):not([type=checkbox])[type=submit]:active,
button:active {
  box-shadow: 0 0 .5em rgba(0, 0, 0, .5);
}

/* Radios and checkboxen */

input[type=radio],
input[type=checkbox] {
  position: absolute;
  top: auto;
  overflow: hidden;
  clip: rect(1px 1px 1px 1px); /* IE 6/7 */
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px;
  height: 1px;
  white-space: nowrap; /* https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe */
}

input[type=radio] + label,
input[type=checkbox] + label {
  display: block;
  padding: .5em;
  padding-left: 2em;
  /* text-indent: 0em; */
  max-width: calc(100% - 2em);
  /*margin: -1em 0;*/
}

fieldset > div input[type=radio] + label {
  margin: -1em 0;
}

input[type=radio]:focus + label,
input[type=checkbox]:focus + label {
  color: #00f;
  outline: 1px dotted #00f;
}

input[type=radio] + label:before,
input[type=checkbox] + label:before {
  content: '';
  background: #fff;
  border: .1em solid rgba(0, 0, 0, .75);
  background-color: rgba(255, 255, 255, .8);
  display: block;
  box-sizing: border-box;
  float: left;
  width: 1em;
  height: 1em;
  margin-left: -1.5em;
  margin-top: .15em;
  vertical-align: top;
  cursor: pointer;
  text-align: center;
  transition: all .1s ease-out;
}

input[type=radio] + label:before {
  border-radius: 100%;
}

input[type=radio]:disabled + label:before,
input[type=checkbox]:disabled + label:before {
  border: .1em solid rgba(0, 0, 0, .1);
  background-color: rgba(0, 0, 0, .1);
}

input[type=radio]:disabled + label,
input[type=checkbox]:disabled + label {
  color: #ccc;
}

input[type=radio]:checked + label:before {
  background-color: #00f;
  box-shadow: inset 0 0 0 .15em rgba(255, 255, 255, .95);
}

input[type=checkbox] + label:before {
  /*content: '\00d7';*/
  /*content: '\002718';*/
  /*content: '\002715';*/
  /*content: '\0025a0';*/
  content: '\002713';
  font-weight: bold;
  text-align: center;
  line-height: 1.15;
  color: rgba(0, 0, 255, 0);
}

input[type=checkbox]:checked + label:before {
  color: rgba(0, 0, 255, 1);
  line-height: .75;
  text-shadow: .05em 0 0 rgba(0, 0, 255, 1), -.05em 0 0 rgba(0, 0, 255, 1);
}

input[type=checkbox]:disabled + label:before {
  color: rgba(255, 255, 255, 0);
}

input[type=checkbox]:checked:disabled + label:before {
  color: #bbb;
  text-shadow: .05em 0 0 #bbb, -.05em 0 0 #bbb;
}

@media screen and (-ms-high-contrast: active) {
  input[type=checkbox] + label:before {
    content: ' ';
  }
  input[type=checkbox]:checked + label:before {
    content: '\002713';
  }
  input[type=radio] + label:before {
    content: ' ';
  }
  input[type=radio]:checked + label:before {
    content: '\00d7';
    line-height: .75;
    background-color: transparent;
    box-shadow: none;
  }
  input[type=checkbox]:disabled + label, input[type=radio]:disabled + label {
    color: grayText;
    cursor: not-allowed;
  }
}
            
          
!
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