cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation


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.

<h1> CSS Grid Play - positioning with template rows/columns</h1>
<div class="wrapper">
  <div>div 1</div>
  <div>div 2</div>
  <div>div 3</div>
  <div>div 4</div>
  <div>div 5</div>
  <div>div 6</div>
  <div>div 7</div>
  <li>The striped squares are made by div 3 (with an transparent background pattern) overlaping other divs.</li>
  <li>Div 4 is out of order because it was placed in row 3. Div 5 is not positioned and takes the next available spot after Div 3. </li>
  <li>There is an empty spot in the center of the grid</li>
  <li>Seriously?  How cool is this?</li>
  grid-template-columns: repeat(4, [col] 1fr);
  grid-template-rows: repeat(3, [row] auto);
  grid-gap: 1em;
  background: grey;

.wrapper > div {
 min-height: 100px;
 padding: 5px;
 border: 1px solid black;
 background-color: white;

.wrapper > div:nth-child(1){
  grid-column: col 1 / span 2;
  grid-row: row;
  background-color: yellow;

.wrapper > div:nth-child(2){
  grid-column: col 3/ span 2;
  grid-row: row;
  background-color: purple;

.wrapper > div:nth-child(3){
  grid-column: col 2/ span 2;
  grid-row: row /span 3;
  background: repeating-linear-gradient(
    rgba(0, 0, 0, 0.2),
    rgba(0, 0, 0, 0.2) 10px,
    rgba(0, 0, 0, 0.3) 10px,
    rgba(0, 0, 0, 0.3) 20px

.wrapper > div:nth-child(4){
  grid-column: col 1/ span 2;
  grid-row: row 3;

.wrapper > div:nth-child(6){
  grid-column: col 4/ span 1;
  grid-row: row 2;

.wrapper > div:nth-child(7){
  grid-column: col 3/ span 2;
  grid-row: row 3;
Loading ..................