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.

            
              <input type="radio" id="ux-opt1" name="ux" value="1" />
<input type="radio" id="ux-opt2" name="ux" value="2" />
<input type="radio" id="ux-opt3" name="ux" value="3" />
<input type="radio" id="ux-opt4" name="ux" value="4" />
<div class="opt-sel" tabindex="1">Options&hellip;
  <ul tabindex="1">
    <li><label for="ux-opt1">Show Option 1</label></li>
    <li><label for="ux-opt2">Show Option 2</label></li>
    <li><label for="ux-opt3">Show Option 3</label></li>
    <li><label for="ux-opt4">Show Option 4</label></li>
  </ul>
</div>
<p class="opt o1">Awesome. You selected option 1</p>
<p class="opt o2">Even Better. You selected option 2</p>
<p class="opt o3">Well that sucks. You selected option 3</p>
<p class="opt o4">You selected option 4. It's my favourite.</p>

            
          
!
            
              BODY {
 width:240px; 
}

INPUT[id^="ux"] {
   display:none; 
}
P.opt {
  display:none; 
}
INPUT[value="1"]:CHECKED ~ P.o1 {
    display:block;
}
INPUT[value="2"]:CHECKED ~ P.o2 {
    display:block;
}
INPUT[value="3"]:CHECKED ~ P.o3 {
    display:block;
}
INPUT[value="4"]:CHECKED ~ P.o4 {
    display:block;
}
.opt-sel {
   display:inline-block;
   width:auto;
   border:2px outset blue;
   border-radius:5px;
   padding:2px 5px;
   background-color:blue;
   color:white;
   font-family:Helvetice,Tahoma,Arial,sans-serif;
   font-weight:bold;
}
.opt-sel UL {
   position:absolute;
   list-style:none;
   padding:0;
   margin:0;
   color:black;
   background-color:white;
   border:1px solid black;
   font-family:Helvetice,Tahoma,Arial,sans-serif;
   font-weight:normal;
}
.opt-sel:not(:FOCUS) UL {
  display:none;
}
.opt-sel:FOCUS UL,
.opt-sel UL:ACTIVE {
  display:block;
}
.opt-sel LABEL {
  padding:1px 5px;
}
.opt-sel LABEL:HOVER {
   background-color:lightblue;
   color:black;
}
.opt-sel LABEL:ACTIVE,
INPUT[value="1"]:CHECKED ~ .opt-sel LABEL[for="ux-opt1"],
INPUT[value="2"]:CHECKED ~ .opt-sel LABEL[for="ux-opt2"],
INPUT[value="3"]:CHECKED ~ .opt-sel LABEL[for="ux-opt3"],
INPUT[value="4"]:CHECKED ~ .opt-sel LABEL[for="ux-opt4"] {
   background-color:blue;
   color:white;
}

            
          
!
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