Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <p>Alege culoarea ta preferata:</p>
<div class="bkg-wrapper">
  <input name="color" class="bkg1 bkg-select" type="radio"><span class="bkg1"></span>
  <input name="color" class="bkg2 bkg-select" type="radio"><span class="bkg2"></span>
  <input name="color" class="bkg3 bkg-select" type="radio"><span class="bkg3"></span>
  <div class="bkg-container"></div>
</div>
              
            
!

CSS

              
                /* wrapper for everything */
.bkg-wrapper{
  width:300px;
  height:300px;
  position:relative; 
}
/* div that will change background color */
.bkg-container{
  width:100%;
  height:100%;
  position:relative; 
  border-radius:4px;
  transition:0.3s ease-out;
  margin-top:10px;
  border:1px solid #000;
}
/* spans that will reprezent the input colors */
.bkg-wrapper span{
  display:inline-block;
  width:33px;
  height:33px;
  margin-left:-33px;
  pointer-events:none;
  border-radius:2px
}
.bkg1{background:#CE1126}
.bkg2{background:#FCD116}
.bkg3{background:#002B7F}

/* input styling */
.bkg-select{
  position:relative;
  width:32px;
  height:32px;
  margin-right:1px;
  cursor:pointer;
  opacity:0;
} 
.bkg-select:checked{
  opacity:0.3;
}
/* change background on checked */
input.bkg1:checked ~ .bkg-container{
  background:#CE1126;
}
input.bkg2:checked ~ .bkg-container{
  background:#FCD116;
}
input.bkg3:checked ~ .bkg-container{
  background:#002B7F;
}
              
            
!

JS

              
                
              
            
!
999px

Console