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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <h1>Layouts</h1>
<p>Simple 4 column grid</p>
<div class="grid grid-col-3">
  <div class="item item-1">col 1</div>
  <div class="item item-2">col 2</div>
  <div class="item item-3">col 3</div>
  <div class="item item-4">col 4</div>
</div>

<p>2x2 columns</p>
<div class="grid grid-2x2">
  <div class="item item-1">col 1</div>
  <div class="item item-2">col 2</div>
  <div class="item item-3">col 3</div>
  <div class="item item-4">col 3</div>
</div>

<p>Responsive Layout (resize Browser Width)</p>
<div class="grid grid-responsive">
  <div class="item item-1">col 1</div>
  <div class="item item-2">col 2</div>
  <div class="item item-3">col 3</div>
  <div class="item item-4">col 3</div>
</div>

<h1>Grid Positions</h1>
<p>Default positioning with grid-column-start and grid-column-end</p>
<div class="grid grid-position-1">
  <div class="item item-1">col 1</div>
  <div class="item item-2">col 2</div>
  <div class="item item-3">col 3</div>
  <div class="item item-4">col 4</div>
</div>

<p>Swapped positions with shorthand syntax</p>
<div class="grid grid-position-2">
  <div class="item item-1">col 1</div>
  <div class="item item-2">col 2</div>
  <div class="item item-3">col 3</div>
  <div class="item item-4">col 4</div>
</div>

<p>Positioning with named areas. DOM order is: Home, Feed, About, Imprint</p>
<div class="grid grid-position-3">
  <div class="item item-1">Home</div>
  <div class="item item-2">Feed</div>
  <div class="item item-3">About</div>
  <div class="item item-4">Imprint</div>
</div>

<h1>A simple layout</h1>
<p>Grid without named areas</p>
<div class="grid grid-layout-unnamed">
  <div class="item header">Header</div>
  <div class="item navigation">Navigation</div>
  <div class="item sidebar">Sidebar</div>
  <div class="item content">Content</div>
  <div class="item footer">Footer</div>
</div>

<p>Grid with named areas</p>
<div class="grid grid-layout-named">
  <div class="item header">Header</div>
  <div class="item navigation">Navigation</div>
  <div class="item sidebar">Sidebar</div>
  <div class="item content">Content</div>
  <div class="item footer">Footer</div>
</div>
              
            
!

CSS

              
                // General Styling
body { color: black; font-size: 62.5%;}
h1 { font-size: 2rem; text-align: center; }
p { font-size: 1.3rem; font-weight: italic; color: grey; text-align: center; display: block; margin: 1rem;}
.grid {margin-bottom: 4rem;}
.item {
   color: white;
   text-align: center;
   font-size: 1.4rem;
   padding-top: 1rem;
   &:nth-child(1) { background: lightblue;} 
   &:nth-child(2) { background: red;} 
   &:nth-child(3) { background: lightgreen;} 
   &:nth-child(4) { background: purple;} 
   &:nth-child(5) { background: darkgrey;} 
}

// CSS GRID MODULE
// get grid to grid. redundancy is redundant. :D
.grid {
   display: grid;
}

// simple 3 column grid
.grid-col-3 {
   grid-template-columns: 1fr 1fr 1fr 1fr;
   grid-template-rows: 10vh;
}

// simple 3 column grid
.grid-2x2 {
   grid-template-columns: 1fr 1fr;
   grid-template-rows: 10vh 10vh;
}

.grid-responsive {
   grid-template-columns: 1fr 1fr;
   grid-template-rows: 10vh 10vh;
   
   @media screen and (min-width: 678px) {
      grid-template-columns: 1fr 1fr 1fr 1fr;
      grid-template-rows: 10vh;
   }
}

// Default positioning
.grid-position-1 {
   grid-template-columns: 1fr 1fr 1fr 1fr;
   grid-template-rows: 10vh 10vh 10vh;
   
   .item-1 {
      grid-column-start: 1;
      grid-column-end: 5;
      grid-row: 1;
   }
   .item-2 {
      grid-column-start: 1;
      grid-column-end: 3;
      grid-row: 2;
   }
   .item-3 {
      grid-column-start: 4;
      grid-column-end: 5;
      grid-row: 2;
   }
   .item-4 {
      grid-column-start: 1;
      grid-column-end: 5;
      grid-row: 3;
   }
}


.grid-position-2 {
   grid-template-columns: 1fr 1fr 1fr 1fr;
   grid-template-rows: 10vh 10vh 10vh;
   
   .item-1 {
      // grid-column-start: 4;
      // grid-column-end: 5;
      grid-column: 1 / 5;
      grid-row: 3;
   }
   .item-2 {
      grid-column: 1 / 3;
      grid-row: 2;
   }
   .item-3 {
      grid-column: 4 / 5;
      grid-row: 2;
   }
   .item-4 {
      grid-column: 1 / 5;
      grid-row: 1;
   }
}

.grid-position-3 {
   grid-template-columns: 1fr 1fr 1fr 1fr;
   grid-template-rows: 10vh 10vh 10vh;
   grid-template-areas: "home home home home"
                        "feed feed . about"
                        "imprint imprint imprint imprint";
   
   .item-1 {
      grid-area: home;
   }
   .item-2 {
      grid-area: feed;
   }
   .item-3 {
      grid-area: about;
   }
   .item-4 {
      grid-area: imprint;
   }
}


.grid-layout-unnamed {
   height: 100vh;
   grid-template-columns: 1fr 1fr 1fr 1fr; 
   grid-template-rows: 1fr .5fr 5fr .5fr;
   .header {
      grid-column: 1/5;
      grid-row: 1fr;
   }
   .navigation {
      grid-column: 1/5;
      grid-row: .5fr;
   }
   .sidebar {
      grid-column: 1/2;
      grid-row: 5fr;
   }
   .content {
      grid-column: 2/5;
      grid-row: 5fr;
   }
   .footer {
      grid-column: 1/5;
      grid-row: 1fr;
   }
}
.grid-layout-named {
   height: 100vh;
   grid-template-columns: 1fr 1fr 1fr 1fr; 
   grid-template-rows: 1fr .5fr 5fr .5fr;
   grid-template-areas: "header header header header"
                        "navigation navigation navigation navigation"
                        "sidebar content content content"
                        "footer footer footer footer";
   .header {
       grid-area: header; 
   }
   .navigation {
       grid-area: navigation; 
   }
   .sidebar {
       grid-area: sidebar; 
   }
   .content {
       grid-area: content; 
   }
   .footer {
       grid-area: footer; 
   }
}
              
            
!

JS

              
                
              
            
!
999px

Console