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

              
                <div class="container">
 <header class="custom-padding" style="--padding-both: 2">
   <h1>Smart classes with custom properties</h1>
      <p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Et eos exercitationem repudiandae unde nemo tempora facilis voluptatum esse iste omnis? Repellat dolorum minima sapiente, at aliquid dolores vitae voluptatum iure?</p>
  </header>
  <hr>
 <div class="custom-padding">
     <p>Veritatis illo velit, fuga dolores repellat omnis perspiciatis libero accusamus? Veritatis libero voluptates, assumenda beatae rerum culpa minima voluptate, ut quia maxime perspiciatis, blanditiis iure velit suscipit totam deleniti praesentium?</p>

    <p>Ea voluptatibus dolores, facilis maiores odio ullam delectus magnam hic quam unde harum tempora architecto illo nam voluptatum fugit iusto debitis sit id sequi modi fugiat, sint blanditiis! Est, ratione.</p>
  </div>
  <hr>
  <!-- flexibilidad total -->
<div class="custom-padding" style="--padding-top:0.5; --padding-bottom: 1.5;">
  <p>Rem, odit fugit. Nisi quos nesciunt odit corporis ullam quae, perspiciatis distinctio et eaque? Maiores, amet officiis sint asperiores, accusamus iste facilis eaque unde deserunt sapiente aperiam quos. Nobis, nihil.</p>
  <p>Dolorum nam vero, enim quis culpa velit, optio quasi ipsam doloremque odio recusandae explicabo libero ullam beatae distinctio temporibus repudiandae officia, nulla non neque? Accusantium incidunt molestias explicabo inventore veritatis.</p>        </div>
<hr>
  <p class="custom-padding" style="--padding-bottom:0;">Corrupti, voluptas itaque. Sint voluptatum rem ullam iure eligendi itaque, ab ducimus veritatis at dolorem aspernatur exercitationem eos a. Obcaecati aliquid temporibus rerum voluptate tenetur suscipit vel incidunt reprehenderit omnis?</p>
  
  <div style="--custom-margin-top:3">
    <p><strong>Ahora sin utilizar clases</strong></p>
  </div>
  <p>Porro dolores omnis rem quos nesciunt nemo atque ipsa unde culpa soluta nisi accusantium esse labore architecto sunt, optio deserunt hic earum saepe commodi dicta. Rem consequatur dicta sed maiores.</p>
  <p>Perferendis quia atque architecto maiores veritatis neque odit nisi, fugit ducimus deserunt ex mollitia dignissimos veniam fuga numquam animi? Iure dignissimos culpa ipsam vero minus, impedit reprehenderit fugit numquam nihil?</p>
</div>
              
            
!

CSS

              
                :root {
  /* Unidad de espacidado */
  --space: calc(.5rem + 2vw);
  --color-lines: rgba(0,0,0, .4);
}

/* Centralizado y actualización dinámica */
@media(min-width: 1600px) {
  :root {
    --space: 2.5rem;
  }
}

/*
 valor por defecto 1 espacio arriba y abajo
 máxima flexibilidad
*/
.custom-padding {
    padding-top: calc( var(--padding-top, 
                       var(--padding-both, 1))
                       * var(--space)
                      );
  
    padding-bottom: calc( var(--padding-bottom, 
                          var(--padding-both, 1))
                       * var(--space)
                      );
}


/* 🔥 ahora sin clase */
[style*="--custom-margin-bottom"] {
  margin-bottom: calc( var(--custom-margin-bottom) * var(--space));
}

[style*="--custom-margin-top"] {
  margin-top: calc( var(--custom-margin-top) * var(--space));
}


/* ------------------------------------- */







/* Solo para presentación */
h1 {
  font-size: 3rem;
  line-height: 1.2;
  margin-bottom: var(--space);
}
p:not(:last-child) {
  margin:0 0 var(--space);
}

.custom-padding:nth-of-type(2) {
  max-width: 780px;
  margin-left: auto;
  
}
.container {
  width: 90%;
  margin:auto;
  max-width: 970px;
}

header {
  max-width: 620px;
}
hr {
  border:0;
  border-top: 1px dotted var(--color-lines);
  margin: 0 calc(-50vw - 50%);
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont,
    “Segoe UI”, “Roboto”, “Oxygen”, “Ubuntu”, “Cantarell”,
    “Fira Sans”, “Droid Sans”, “Helvetica Neue”,
    sans-serif;
  font-size: 17px;
  line-height: 1.6;
  padding-bottom: calc(var(--space) * 4);
}
  
* {
  box-sizing: border-box;
  margin:0;
}

              
            
!

JS

              
                
              
            
!
999px

Console