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

              
                <h1>Grid Test <small>All examples use same html</small></h1>
<div class="container container1">
  <div class="col column1">
    <h2>Column 1</h2>
    <p>Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content </p>
  </div>
  <div class="col column2">
    <h2>Column 2</h2>
    <p>Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content </p>
  </div>
  <div class="col column3">
    <h2>Column3</h2>
    <p>Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content </p>
  </div>
</div>
<footer>
    <p>Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here </p>
</footer>


<h1>Grid Test 2</h1>
<div class="container container2">
  <div class="col column1">
    <h2>Column 1</h2>
    <p>Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content </p>
  </div>
  <div class="col column2">
    <h2>Column 2</h2>
    <p>Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content </p>
  </div>
  <div class="col column3">
    <h2>Column3</h2>
    <p>Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content </p>
  </div>
</div>
<footer>
    <p>Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here </p>
</footer>



<h1>Grid Test 3</h1>
<div class="container container3">
  <div class="col column1">
    <h2>Column 1</h2>
    <p>Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content </p>
  </div>
  <div class="col column2">
    <h2>Column 2</h2>
    <p>Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content </p>
  </div>
  <div class="col column3">
    <h2>Column3</h2>
    <p>Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content </p>
  </div>
</div>
<footer>
    <p>Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here </p>
</footer>


<h1>Grid Test 4 <small>Sticky left and right columns</small></h1>
<div class="container container4">
  <div class="col column1">
    <h2>Column 1</h2>
    <p>Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content </p>
  </div>
  <div class="col column2">
    <h2>Column 2</h2>
    <p>Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content </p>
    <p>Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content </p>
    <p>Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content </p>
  </div>
  <div class="col column3">
    <h2>Column3</h2>
    <p>Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content </p>
  </div>
</div>
<footer>
    <p>Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here </p>
</footer>

<h1>Grid Test 5 <small>Sticky left column</small></h1>
<div class="container container5">
  <div class="col column1">
    <h2>Column 1</h2>
    <p>Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content Column 1 content </p>
  </div>
  <div class="col column2">
    <h2>Column 2</h2>
    <p>Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content </p>
    <p>Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content </p>
    <p>Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content Column 2 content </p>
  </div>
  <div class="col column3">
    <h2>Column3</h2>
    <p>Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content Column 3 content </p>
  </div>
</div>
<footer>
    <p>Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here Footer goes here </p>
</footer>

<div class="disclaimer">
	<h3>Experiments only</h3>
	<p>All the above are just experiments and untested with real use cases or real content.</p> 
	<p>Please use with care and thoroughly test in the browers you want to support using real content rather than dummy text.</p>
</div>
              
            
!

CSS

              
                html {
  box-sizing: border-box;
}
*,
*:before,
*:after {
  box-sizing: inherit;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}
h1 {
  text-align: center;
}
.container {
  display: grid;
  width: 100%;
  grid-template-areas:
    "side1  main side2"
    "side1  main2 main2"
    "side1  main3 main3";
  grid-template-rows: auto;
  grid-template-columns: 1fr 6fr 1fr;
  grid-column-gap: 1rem;
  margin-bottom: 1rem;
}
.col {
  padding: 1rem;
}
.column1 {
  grid-area: side1;
  background-color: #ffa08c;
  min-width: 200px;
}
.column2 {
  grid-area: main;
  background-color: #ffff64;
}
.column3 {
  grid-area: side2;
  background-color: #eee;
  min-width: 200px;
}
footer {
  padding: 1rem;
  margin: 1rem 0 3rem;
  border-bottom: 5px solid #000;
  background-color: #8cffa0;
}
@media screen and (min-width: 1450px) {
  .container1 {
    grid-template-columns: auto auto auto;
  }
  .container1 .column2 {
    width: 980px;
  }
}
@media screen and (max-width: 762px) {
  /* re-arrange as required for smaller screens*/
  /* I've just set it to block because I'm lazy */
  .container {
    display: block;
  }
}

/* second example */
.container2 .column2 {
  grid-area: main2;
}
.container2 .column3 {
  grid-area: main3;
}

/* third example*/
.container3 {
  grid-template-columns: 0fr 1fr 0fr;
  grid-column-gap: 0;
}
.container3 .column1,
.container3 .column3 {
  display: none;
}
.container3 .column2 {
  max-width: 980px;
  margin: 0 auto;
}

/* fourth example*/
.container4 {
  align-items: start;
}
.container4 .column1,
.container4 .column3 {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
}

/* fifth example*/
.container5 {
  align-items: start;
}
.container5 .column1 {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
}
.container5 .column2 {
  grid-area: main2;
}
.container5 .column3 {
  grid-area: main3;
}

.disclaimer {
  max-width: 980px;
  background: #666;
  color: #f9f9f9;
  padding: 1rem;
  font-size: 1.5rem;
  margin: 2rem auto;
}

              
            
!

JS

              
                
              
            
!
999px

Console