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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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="inputs">
  <input checked id="0 auto" name="margin" type="radio"/>
  <label for="0 auto">margin: 0 auto</label>
  <br>
  <input id="30px" name="margin" type="radio"/>
  <label for="30px">margin: 30px</label>
  <br>
  <input id="30px 0" name="margin" type="radio"/>
  <label for="30px 0">margin: 30px 0</label>
  <br>
  <input id="30px 10px" name="margin" type="radio"/>
  <label for="30px 10px">margin: 30px 10px</label>
  <br>
  <input id="10px 30px" name="margin" type="radio"/>
  <label for="10px 30px">margin: 10px 30px</label>
  <br>
  <input id="10px 30px 40px" name="margin" type="radio"/>
  <label for="10px 30px 40px">margin: 10px 30px 40px</label>
  <br>
  <input id="5px 10px 40px 10px" name="margin" type="radio"/>
  <label for="5px 10px 40px 10px">margin: 5px 10px 40px 10px</label>
  <br>
</div> 
<div class="parent">
   <div class="child">
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem nonummy nibh 
    euismod tincidunt ut lacreet dolore magna aliguam erat volutpat. Ut wisis enim 
    ad minim veniam, quis nostrud exerci tution ullamcorper suscipit lobortis nisl 
    ut aliquip ex ea commodo consequat. 
   </div>
</div>
              
            
!

CSS

              
                body { 
   margin: 0; /* забыраємо відступи */
}
.parent {
   width: 500px;
   margin: auto;
   background: #fd0; /* колір фону */
   padding: 10px; /* Поля навколо тексту */
}
.child {
   border: 3px solid #666; /* Параметри рамки */
   padding: 10px; /* Поля навколо тексту */
   margin: 10px; /* відступи навкруги */
}
.inputs {
  margin:8px auto 8px;
	width:500px;
}
              
            
!

JS

              
                var child = $('.child');

$('.inputs').find('input').on('change', function() {
  var input_id = $(this).attr('id'); // Вибірка ідентифікатора
  // var label = $('label[for="'+input_id+'"]'); // Вибірка лейбла
  
  child.css('margin', input_id);
  // child.text(label.text());
});
              
            
!
999px

Console