cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

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.

            
              <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
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