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="buttons">
  <p class="intro">Clicca il bottone <code>border-box</code> per correggere questo layout grazie al potere del Box Sizing!</p>
  <button id="content">content-box</button>
  <button id="border">border-box</button>
</div>
<div class="parent">
  <p>Elemento genitore con una larghezza del 50% e un bordo di 5px di colore verde.</p>
  <div class="child">
    <p>Elemento figlio con larghezza del 90%, 4px di bordo arancione e un padding al 20%.</p>
  </div>
  <div class="twins">
    <p>Elemento figlio con larghezza del 50%, 4px di bordo arancione e un padding a 1em.</p>
  </div>
  <div class="twins">
    <p>Elemento figlio con larghezza del 50%, 4px di bordo arancione e un padding a 1em.</p>
  </div>
</div>
              
            
!

CSS

              
                .parent {
  width: 50%;
  border: 5px solid #1ABC9C;
  float: left;
}

.child {
  width: 90%;
  padding: 20%;
  border: 4px solid #EF6C00;
  margin: .5em auto;
}

.twins {
  width: 50%;
  padding: 1em;
  border: 4px solid #EF6C00;
  float: left;
}


/* styling for Pen, not related to box-sizing or layout */

body {
  font-family: sans-serif;
  font-size: 1.1em;
}

.buttons {
  margin-bottom: .5em;
}

p:not(.intro) {
  text-align: center;
}
              
            
!

JS

              
                $("#content").on("click", function() {
  $("*").css("box-sizing", $(this).text());
});

$("#border").on("click", function() {
  $("*").css("box-sizing", $(this).text());
});
              
            
!
999px

Console