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

              
                <!-- First Example -->

<section class="example example-grid">
  <nav class="example-subgrid">
    <h3>Column One</h3>
    <a href="#">Links should align vertically</a>
  </nav>
  <nav class="example-subgrid">
    <h3>Column Two's Title Is Longer</h3>
    <a href="#">Links should align vertically</a>
  </nav>
  <nav class="example-subgrid">
    <h3>Column Three</h3>
    <a href="#">Links should align vertically</a>
  </nav>
  <nav class="example-subgrid">
    <h3>Column Four</h3>
    <a href="#">Links should align vertically</a>
  </nav>
</section>

<!-- Second Example -->

<section class="example example-grid">
  <nav class="example-subgrid-multiple" role="navigation" aria-label="Column One Navigation">
    <h3>Column One</h3>
    <a href="#">Links should align vertically</a>
  </nav>
  <nav class="example-subgrid-multiple" role="navigation" aria-label="Column Two Navigation">
    <h3>Column Two's Title Is Longer</h3>
    <a href="#">Links should align vertically</a>
    <a href="#">Links should align vertically</a>
  </nav>
  <nav class="example-subgrid-multiple" role="navigation" aria-label="Column Three Navigation">
    <h3>Column Three</h3>
    <a href="#">Links should align vertically</a>
    <a href="#">Links should align vertically</a>
    <a href="#">Links should align vertically</a>
  </nav>
  <nav class="example-subgrid-multiple" role="navigation" aria-label="Column Four Navigation">
    <h3>Column Four</h3>
    <a href="#">Links should align vertically</a>
    <a href="#">Links should align vertically</a>
    <a href="#">Links should align vertically</a>
    <a href="#">Links should align vertically</a>
  </nav>
</section>

<!-- Third Example -->

<section class="example example-grid">
  <nav class="example-subgrid-ul" role="navigation" aria-label="Column One Navigation">
    <h3>Column One</h3>
    <ul>
      <li><a href="#">Links should align vertically</a></li>
    </ul>
  </nav>
  <nav class="example-subgrid-ul" role="navigation" aria-label="Column Two Navigation">
    <h3>Column Two's Title Is Longer</h3>
    <ul>
      <li><a href="#">Links should align vertically</a></li>
      <li><a href="#">Links should align vertically</a></li>
    </ul>
  </nav>
  <nav class="example-subgrid-ul" role="navigation" aria-label="Column Three Navigation">
    <h3>Column Three</h3>
    <ul>
      <li><a href="#">Links should align vertically</a></li>
      <li><a href="#">Links should align vertically</a></li>
      <li><a href="#">Links should align vertically</a></li>
    </ul>
  </nav>
  <nav class="example-subgrid-ul" role="navigation" aria-label="Column Four Navigation">
    <h3>Column Four</h3>
    <ul>
      <li><a href="#">Links should align vertically</a></li>
      <li><a href="#">Links should align vertically</a></li>
      <li><a href="#">Links should align vertically</a></li>
      <li><a href="#">Links should align vertically</a></li>
    </ul>
  </nav>
</section>

<!-- Fourth Example -->

<section class="example example-grid">
  <nav class="example-subgrid-sets" role="navigation" aria-label="Column One Navigation">
    <h3>Column One</h3>
    <div>
      <ul>
        <li><a href="#">Links should align vertically</a></li>
      </ul>
      <h3>This one has another set</h3>
      <ul>
        <li><a href="#">Links should align vertically</a></li>
        <li><a href="#">Links should align vertically</a></li>
      </ul>
    </div>
  </nav>
  <nav class="example-subgrid-sets" role="navigation" aria-label="Column Two Navigation">
    <h3>Column Two's Title Is Longer</h3>
    <div>
      <ul>
        <li><a href="#">Links should align vertically</a></li>
        <li><a href="#">Links should align vertically</a></li>
      </ul>
      <h3>This one has another set</h3>
      <ul>
        <li><a href="#">Links should align vertically</a></li>
        <li><a href="#">Links should align vertically</a></li>
      </ul>
    </div>
  </nav>
  <nav class="example-subgrid-sets" role="navigation" aria-label="Column Three Navigation">
    <h3>Column Three</h3>
    <div>
      <ul>
        <li><a href="#">Links should align vertically</a></li>
        <li><a href="#">Links should align vertically</a></li>
        <li><a href="#">Links should align vertically</a></li>
      </ul>
    </div>
  </nav>
  <nav class="example-subgrid-sets" role="navigation" aria-label="Column Four Navigation">
    <h3>Column Four</h3>
    <div>
      <ul>
        <li><a href="#">Links should align vertically</a></li>
        <li><a href="#">Links should align vertically</a></li>
        <li><a href="#">Links should align vertically</a></li>
        <li><a href="#">Links should align vertically</a></li>
      </ul>
    </div>
  </nav>
</section>
              
            
!

CSS

              
                /* First Example */

.example-grid {
  column-gap: 32px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  row-gap: 16px;
}

@media screen and (min-width: 600px) {
  .example-grid {
    column-gap: 32px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    row-gap: 16px;
  }
}

.example-subgrid {
  display: grid;
  grid-row: span 2; /* Change me to break things */
  grid-template-rows: subgrid;
}

/* Second Example */

.example-subgrid-multiple {
  display: grid;
  grid-row: span 5; /* This has to match or be higher than the item count, try changing it */
  grid-template-rows: subgrid;
}

/* Third Example */

.example-subgrid-ul {
  display: grid;
  grid-row: span 2; /* Span the h3 and ul rows */
  grid-template-rows: subgrid;
}

/* Final Example */

.example-subgrid-sets {
  display: grid;
  grid-row: span 2; /* h3 and div rows */
  grid-template-rows: subgrid;
}

/* Styles unrelated to the grid/subgrid exmaple */

body {
  font-family: sans-serif;
  padding: 1rem;
}

a {
  display: block;
}

section {
  max-width: 1000px;
  margin-inline: auto;
}

section + section {
  margin-block-start: 2rem;
}

.example {
    background-color: #00081e;
    padding: 1rem;
  }

  .example h3 {
    color: #ffffff;
    font-size: 0.875rem;
    text-transform: uppercase;
    margin: 0;
  }

  .example a {
    border: 0;
    color: #ffffff;
    font-size: 0.875rem;
    line-height: 1.25;
    opacity: 0.75;
    text-decoration: none;
  }

  .example a:active,
  .example a:focus,
  .example a:hover {
    color: #ffffff;
    opacity: 1;
  }

  .example ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .example li {
    line-height: 1.25;
    margin-block-end: 0.75rem;
  }

  div h3 {
    margin-block-start: 42px;
  }

  .example div h3 + ul {
    margin-block-start: 20px;
  }

.example div ul + h3 {
  margin-block-start: 2rem;
}
              
            
!

JS

              
                
              
            
!
999px

Console