Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

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.

HTML

              
                <div class="container">
  <h1>Stilizzare checkbox e radio button</h1>
  <p>Impariamo come stilizzare checkbox e radio button con il solo CSS3</p>

  <form>
    <div class="box">
      <h2>Checkbox e radio classici</h2>
      <label>
        <input type="checkbox" name="check"> Check 1
      </label>
      <label>
        <input type="checkbox" name="check"> Check 2
      </label>
      <label>
        <input type="checkbox" name="check"> Check 3
      </label>

      <hr>

      <label>
        <input type="radio" name="radio"> Radio 1
      </label>
      <label>
        <input type="radio" name="radio"> Radio 2
      </label>
      <label>
        <input type="radio" name="radio"> Radio 3
      </label>
    </div>

    <div class="box">
      <h2>Checkbox e radio in CSS3</h2>
      <label class="checkbox-wrapper">Check 1
        <input type="checkbox" name="check">
        <span class="checkmark"></span>
      </label>
      <label class="checkbox-wrapper">Check 2
        <input type="checkbox" name="check">
        <span class="checkmark"></span>
      </label>
      <label class="checkbox-wrapper">Check 3
        <input type="checkbox" name="check">
        <span class="checkmark"></span>
      </label>

      <hr>

      <label class="radio-wrapper">Radio 1
        <input type="radio" name="radio">
        <span class="checkmark"></span>
      </label>
      <label class="radio-wrapper">Radio 1
        <input type="radio" name="radio">
        <span class="checkmark"></span>
      </label>
      <label class="radio-wrapper">Radio 1
        <input type="radio" name="radio">
        <span class="checkmark"></span>
      </label>

    </div>
  </form>
</div>
              
            
!

CSS

              
                /* ----------------------------------------------------------- */
/* GENERALE */
/* ----------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
}
body {
    background-color: #f5f5f5;
}
label {
    display: block;
}
h1 {
    margin: 10px 0 20px 0;
}
h2 {
    margin: 30px 0 10px 0;
}
p {
    margin-bottom: 16px;
}

hr {
    margin: 30px 0;
}

.container {
    width: 960px;
    margin: 60px auto;
    background: #ffffff;
    padding: 30px;
}


/* ----------------------------------------------------------- */
/* CHECKBOX STYLE */
/* ----------------------------------------------------------- */
/* Personalizzo il label e quindi il contenitore dell'input */
.checkbox-wrapper {
    display: block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 22px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Nascondo il checkbox di base del browser */
.checkbox-wrapper input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* creo il mio checkbox */
.checkbox-wrapper .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 25px;
    width: 25px;
    background-color: #eeeeee;
    border: 3px solid transparent;
}

/* Creo la spunta all'interno dell'input (inizialmente nascosta) */
.checkbox-wrapper .checkmark::after {
    content: "";
    position: absolute;
    left: 9px;
    top: 5px;
    width: 5px;
    height: 10px;
    border: solid #2196F3;
    border-width: 0 3px 3px 0;
    -webkit-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    transform: rotate(45deg);
    display: none;
}


/* Quando vado sopra con il mouse (opzionale) */
.checkbox-wrapper:hover input ~ .checkmark {
    background-color: #cccccc;
}

/* Quando l'input è selezionato, coloro il bordo dell'input */
.checkbox-wrapper input:checked ~ .checkmark {
    border-color: #2196F3;
}

/* Quando l'input è selezionato mostro la spunta */
.checkbox-wrapper input:checked ~ .checkmark::after {
    display: block;
}


/* ----------------------------------------------------------- */
/* RADIO STYLE */
/* ----------------------------------------------------------- */
/* Personalizzo il label e quindi il contenitore dell'input */
.radio-wrapper {
    display: block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 22px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Nascondo il checkbox di base del browser */
.radio-wrapper input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* creo il mio checkbox */
.radio-wrapper .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 25px;
    width: 25px;
    background-color: #eeeeee;
    border-radius: 50%;
    border:3px solid transparent;
}

/* Creo la spunta all'interno dell'input (inizialmente nascosta) */
.radio-wrapper .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    top: 8px;
    left: 8px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2196F3;
}

/* Quando vado sopra con il mouse (opzionale) */
.radio-wrapper:hover input ~ .checkmark {
    background-color: #cccccc;
}

/* Quando l'input è selezionato, coloro il bordo dell'input */
.radio-wrapper input:checked ~ .checkmark {
    border-color: #2196F3;
}

/* Quando l'input è selezionato mostro la spunta */
.radio-wrapper input:checked ~ .checkmark::after {
    display: block;
}
              
            
!

JS

              
                
              
            
!
999px

Console