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="l-grid l-grid--side-by-side">
  <div class="l-grid__item">
    <div class="c-card">side-by-side grid</div>
  </div>
  <div class="l-grid__item">
    <div class="c-card">side-by-side grid</div>
  </div>
</div>

<div class="l-grid l-grid--2up">
  <div class="l-grid__item">
    <div class="c-card c-card--blue">2up grid</div>
  </div>
  <div class="l-grid__item">
    <div class="c-card c-card--blue">2up grid</div>
  </div>
</div>

<div class="l-grid l-grid--3up">
  <div class="l-grid__item">
    <div class="c-card">3up grid</div>
  </div>
  <div class="l-grid__item">
    <div class="c-card">3up grid</div>
  </div>
  <div class="l-grid__item">
    <div class="c-card">3up grid</div>
  </div>
</div>

<div class="l-grid l-grid--1-to-3up">
  <div class="l-grid__item">
    <div class="c-card c-card--blue">1-to-3up grid</div>
  </div>
  <div class="l-grid__item">
    <div class="c-card c-card--blue">1-to-3up grid</div>
  </div>
  <div class="l-grid__item">
    <div class="c-card c-card--blue">1-to-3up grid</div>
  </div>
</div>
              
            
!

CSS

              
                /**
 * Grid component
 * 1) This is the parent container that provides default 
 *    gap value and behavior. Items placed in an unmodified
 *    grid component will stack with a gap between them
 * 2) For demo layout only. We don't typically include any 
 *    default margins or padding in our grid component
 */
.l-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem; /* 2 */
}

/**
 * Side-by-side grid
 * 1) Always display the grid items side by side
 */
.l-grid--side-by-side {
  grid-template-columns: 1fr 1fr;
}

/**
 * 2up grid
 * 1) Stack items until there's enough room to     
 *    display them side by side.
 */
.l-grid--2up {
  @media all and (min-width: 40rem) {
    grid-template-columns: 1fr 1fr;
  }
}

/**
 * 3up grid
 * 1) Stack items until there's enough room to     
 *    display them side by side, then display as
 *    three across when enough space is available
 */
.l-grid--3up {
  @media all and (min-width: 40rem) {
    grid-template-columns: 1fr 1fr;
  }
  
  @media all and (min-width: 50rem) {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/**
 * 1-to-3up grid
 * 1) Stack items until there's enough room to     
 *    display as three across. This is often good
 *.   for promo touts 
 */
.l-grid--1-to-3up {
  @media all and (min-width: 50rem) {
    grid-template-columns: 1fr 1fr 1fr;
  }
}


/**
 * Card 
 */
.c-card {
  font-family: system-ui;
  background: salmon;
  border-radius: 1rem;
  padding: 2rem;
}

.c-card--blue {
  background: lightblue;
}
              
            
!

JS

              
                
              
            
!
999px

Console