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.

            
              <h1>Product Variant 1 (Flavor Picker):</h1>
<form action="" class="pdp-flavor-select" novalidate="">
  <fieldset>
    <legend class="pdp-flavor-legend">Flavor:</legend>
    <input id="strawberry" type="radio" checked="checked" name="flavor-select" value="strawberry" class="flavor-select-input">
    <label for="strawberry" class="pdp-flavor-label">
      <span class="label-text">
        <span class="radio-button">
          <img src="http://dummyimage.com/75x75/333/fff" class="flavor-image" alt="Strawberry Flavor" title="Strawberry Flavor" />
        </span>
        <span class="label-value">Flavor: <span class="selection">Strawberry</span></span>
      </span>
    </label>
    
    <input id="very-cherry" type="radio" name="flavor-select" value="very-cherry" class="flavor-select-input">
    <label for="very-cherry" class="pdp-flavor-label">
      <span class="label-text">
        <span class="radio-button"><img src="http://dummyimage.com/75x75/000/fff" class="flavor-image" alt="Very Cherry Flavor" title="Very Cherry Flavor" /></span>
        <span class="label-value">Flavor: <span class="selection">Very Cherry</span></span>
      </span>
    </label>
    
    <input id="raspberry" type="radio" name="flavor-select" value="raspberry" class="flavor-select-input" disabled>
    <label for="raspberry" class="pdp-flavor-label">
      <span class="label-text">
        <span class="radio-button"><img src="http://dummyimage.com/75x75/33f/fff" class="flavor-image" alt="Raspberry Flavor" title="Raspberry Flavor" /></span>
        <span class="label-value">Flavor: <span class="selection">Raspberry</span></span>
      </span>
    </label>
    
    <input id="lemonade" type="radio" name="flavor-select" value="lemonade" class="flavor-select-input">
    <label for="lemonade" class="pdp-flavor-label">
      <span class="label-text">
        <span class="radio-button"><img src="http://dummyimage.com/75x75/f0a/fff" class="flavor-image" alt="Lemonade Flavor" title="Lemonade Flavor" /></span>
        <span class="label-value">Flavor: <span class="selection">Lemonade</span></span>
      </span>
    </label>
  </fieldset>
</form>

<h1>Product Variant 2 (Color Picker):</h1>
<form action="" class="pdp-flavor-select" novalidate="">
  <fieldset>
    <legend class="pdp-flavor-legend">Flavor:</legend>
    <input id="grey-color" type="radio" checked="checked" name="color-select" value="grey-color" class="color-select-input">
    <label for="grey-color" class="pdp-flavor-label">
      <span class="label-text">
        <span class="radio-button color-radio-button">
          <img src="http://dummyimage.com/75x75/333/fff" class="color-image" alt="Grey Color" title="Grey Color" />
        </span>
        <span class="label-value">Color: <span class="selection">Grey</span></span>
      </span>
    </label>
    
    <input id="color-black" type="radio" name="color-select" value="color-black" class="flavor-select-input">
    <label for="color-black" class="pdp-flavor-label">
      <span class="label-text">
        <span class="radio-button  color-radio-button"><img src="http://dummyimage.com/75x75/000/fff" class="color-image" alt="Black Color" title="Black Color" /></span>
        <span class="label-value">Color: <span class="selection">Black</span></span>
      </span>
    </label>
    
    <input id="blue-color" type="radio" name="color-select" value="raspberry" class="flavor-select-input" >
    <label for="blue-color" class="pdp-flavor-label">
      <span class="label-text">
        <span class="radio-button  color-radio-button"><img src="http://dummyimage.com/75x75/33f/fff" class="color-image" alt="Blue Color" title="Blue Color" /></span>
        <span class="label-value">Color: <span class="selection">Blue</span></span>
      </span>
    </label>
    
    <input id="pink-color" type="radio" name="color-select" value="pink-color" class="color-select-input">
    <label for="pink-color" class="pdp-flavor-label">
      <span class="label-text">
        <span class="radio-button  color-radio-button"><img src="http://dummyimage.com/75x75/f0a/fff" class="color-image" alt="Pink Color" title="Pink Color" /></span>
        <span class="label-value">Color: <span class="selection">Pink</span></span>
      </span>
    </label>
</form>
            
          
!
            
              * {
  box-sizing: border-box;
}

fieldset {
  border: 0;
  margin: 0;
  min-width: 0;
  padding: 0;
}

legend {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 0;
  font-size: 1.2em;
  line-height: inherit;
  color: #000;
  border: 0;
  border-bottom: 1px solid #000;
}

label {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 5px;
  font-weight: bold;
}

.pdp-flavor-select {
  display: block;
  padding-top: 1.1em;
  position: relative;
  vertical-align: middle;
}

.pdp-flavor-legend {
  position: absolute;
  left: -999em;
}

.pdp-flavor-label {
  display: inline;
}

.radio-button {
  cursor: pointer;
  cursor: hand;
}

input[type=radio] {
  opacity: 0;
  height: 1px;
  position: absolute;

  &:checked + .pdp-flavor-label {
    .radio-button {
      border-color: red;
      margin: 1px 5px 1px 1px;
    }

    .label-value {
      opacity: 1;
    }
  }

  &:disabled + .pdp-flavor-label {
    overflow: hidden;
    position: relative;

    .radio-button {
      border-color: #aaa;
      opacity: 0.75;

      &:after {
        background: #aaa;
        bottom: 0;
        content: "";
        display: block;
        height: 2px;
        left: -5px;
        position: absolute;
        transform: rotate(-45deg);
        width: 65px;
        top: -16px;
      }
    }
  }
}

.label-value {
  display: block;
  font-size: 1.1em;
  vertical-align: top;
  margin-bottom: 18px;
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
}

.radio-button {
  border: 2px solid #999;
  display: inline-block;
  width: 52px;
  height: 52px;
  margin: 1px 5px 1px 1px;

  &:first-child {
    margin-left: 0;
  }
}

.flavor-image {
  display: block;
  margin: 2px auto 0;
  max-width: 44px;
  width: 100%;
}

.color-radio-button {
  border-radius: 50%;
  border: 2px solid #999;
  display: inline-block;
  width: 30px;
  height: 30px;
  margin: 1px 5px 1px 1px;
}
.color-select-input {
  &:disabled + .pdp-flavor-label {
    .radio-button {
      &:after {
        width: 30px;
      }
    }
  }
}

.color-image {
  border-radius: 50%;
  display: block;
  margin: 1px auto 0;
  max-width: 24px;
  width: 100%;
}
            
          
!
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