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.

            
              <!-- 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>
</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;
  }
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console