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

              
                <!DOCTYPE HTML>
<html lang="en">

	<head>
		<meta charset="utf-8">
		<title>Grid - a flexible grid</title>
      </head>
	<body>
	<h1 class="title">Flexible Grid</h1>
	
	<div class="wrapper">
		<div class="box grid1">01</div>
		<div class="box grid2">02</div>
		<div class="box grid3">03</div>
		<div class="box grid4">04</div>
		<div class="box grid5">05</div>
		<div class="box grid6">06</div>
		<div class="box grid7">07</div>
		<div class="box grid8">08</div>
		<div class="box grid9">09</div>
		<div class="box grid10">10</div>
		<div class="box grid11">11</div>
		<div class="box grid12">12</div>
		<div class="box grid13">13</div>
		<div class="box grid14">14</div>
		<div class="box grid15">15</div>
		<div class="box grid16">16</div>

		<div class="box grid17">17</div>
		<div class="box grid18">18</div>
		<div class="box grid19">19</div>
		<div class="box grid20">20</div>
		<div class="box grid21">21</div>
		<div class="box grid22">22</div>
		<div class="box grid23">23</div>
		<div class="box grid24">24</div>	

		<div class="box grid25">25</div>
		<div class="box grid26">26</div>
		<div class="box grid27">27</div>
		<div class="box grid28">28</div>
		<div class="box grid29">29</div>


		<div class="box grid30">30</div>
		<div class="box grid31">31</div>
		<div class="box grid32">32</div>
		<div class="box grid33">33</div>

		<div class="box grid34">34</div>
		<div class="box grid35">35</div>
		<div class="box grid36">36</div>

		<div class="box grid37">37</div>
		<div class="box grid38">38</div>
		<div class="box grid39">39</div>

		<div class="box grid40">40</div>
		<div class="box grid41">41</div>
		<div class="box grid42">42</div>

		<div class="box grid43">43</div>
		<div class="box grid44">44</div>
		<div class="box grid45">45</div>
	</div>
	</body>
</html>
              
            
!

CSS

              
                body {
	margin: 0;
	padding: 20px;
	background-color: #999;
	color: #fff;
	background-image: url("http://media.24ways.org/2012/andrew/otis_redding.png");
	font: 87.5%/1.4 HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif;
}


h1, h2, h3, h4, h5, h6 {
    font-family: "Georgia","Times New Roman",serif;
    font-weight: normal;
    padding: 0;
    margin: 0;
}

h1 {
    font-size: 328.571%;
    margin-bottom: 0.2em;
}

h1.title {
	text-align: center;
	text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

h2 {
    font-size: 250%;
    margin-bottom: 0.2em;
}

h3 {
    font-size: 150%;
    margin-bottom: 0.2em;
}

p {
	margin:0;
	padding: 0 0 1em 0;
}

.box {
    background-color: #ddd;
    padding: 10px 10px 1px;
    color: #444;
}


.wrapper {	 
  width: 90%;
  margin: 0 auto 0 auto;
  display:grid;
  grid-definition-columns: "gutter" 1fr repeat(16,"col" 4.25fr "gutter" 1fr);
  grid-definition-rows: repeat(9, "row" auto "gutter" 20px);
}


/* this is an example of positioning items on the grid
first row, single column items */
.grid1 { grid-start: "col"; grid-end: span 1; grid-before: "row"; grid-after: span 1;} /* have to specify the span or it goes to the last named */
.grid2 { grid-start: "col" 2; grid-end: span 1; grid-before: "row"; grid-after: span 1;} 
.grid3 { grid-start: "col" 3; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid4 { grid-start: "col" 4; grid-end: span 1; grid-before: "row"; grid-after: span 1;} 
.grid5 { grid-start: "col" 5; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid6 { grid-start: "col" 6; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid7 { grid-start: "col" 7; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid8 { grid-start: "col" 8; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid9 { grid-start: "col" 9; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid10 { grid-start: "col" 10; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid11 { grid-start: "col" 11; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid12 { grid-start: "col" 12; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid13 { grid-start: "col" 13; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid14 { grid-start: "col" 14; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid15 { grid-start: "col" 15; grid-end: span 1; grid-before: "row"; grid-after: span 1;}
.grid16 { grid-start: "col" 16; grid-end: span 1; grid-before: "row"; grid-after: span 1;}

/* second row items span 2 columns and one gutter */
.grid17 { grid-start: "col"; grid-end: span 1; grid-before: "row" 2; grid-after: span 1; }
.grid18 { grid-start: "col" 3; grid-end: span 2 "gutter"; grid-before: "row" 2; grid-after: span 1; }
.grid19 { grid-start: "col" 5; grid-end: span 2 "gutter"; grid-before: "row" 2; grid-after: span 1; }
.grid20 { grid-start: "col" 7; grid-end: span 2 "gutter"; grid-before: "row" 2; grid-after: span 1; }
.grid21 { grid-start: "col" 9; grid-end: span 2 "gutter"; grid-before: "row" 2; grid-after: span 1; }
.grid22 { grid-start: "col" 11; grid-end: span 2 "gutter"; grid-before: "row" 2; grid-after: span 1; }
.grid23 { grid-start: "col" 13; grid-end: span 2 "gutter"; grid-before: "row" 2; grid-after: span 1; }
.grid24 { grid-start: "col" 15; grid-end: span 2 "gutter"; grid-before: "row" 2; grid-after: span 1; }

/*
 third row we have 4 items spanning 3 cols and 1 spanning 4 */
.grid25 { grid-start: "col"; grid-end: span 3 "gutter"; grid-before: "row" 3; grid-after: span 1; }
.grid26 { grid-start: "col" 4; grid-end: span 3 "gutter"; grid-before: "row" 3; grid-after: span 1; }
.grid27 { grid-start: "col" 7; grid-end: span 3 "gutter"; grid-before: "row" 3; grid-after: span 1; }
.grid28 { grid-start: "col" 10; grid-end: span 3 "gutter"; grid-before: "row" 3; grid-after: span 1;}
.grid29 { grid-start: "col" 13; grid-end: span 4 "gutter"; grid-before: "row" 3; grid-after: span 1; }

/* fourth row 4 items spanning 4 columns each */
.grid30 { grid-start: "col"; grid-end: span 4 "gutter"; grid-before: "row" 4; grid-after: span 1; }
.grid31 { grid-start: "col" 5; grid-end: span 4 "gutter"; grid-before: "row" 4; grid-after: span 1;}
.grid32 { grid-start: "col" 9; grid-end: span 4 "gutter"; grid-before: "row" 4; grid-after: span 1; }
.grid33 { grid-start: "col" 13; grid-end: span 4 "gutter"; grid-before: "row" 4; grid-after: span 1; }

/* various positioned boxes ... */
.grid34 { grid-start: "col"; grid-end: span 1; grid-before: "row" 5; grid-after: span 1; }/*  1st col 5th row 1 unit  */
.grid35 { grid-start: "col"; grid-end: span 1; grid-before: "row" 6; grid-after: span 1; } /*  1st col 6th row 1 unit */
.grid36 { grid-start: "col"; grid-end: span 1; grid-before: "row" 7; grid-after: span 1; } /*  1st col 7th row 1 unit */
.grid37 { grid-start: "col"; grid-end: span 1; grid-before: "row" 8; grid-after: span 1; } /*  1st col 8th row 1 unit */
.grid38 { grid-start: "col" 11; grid-end: span 6 "gutter"; grid-before: "row" 5; grid-after: span 4 "gutter"; } /*  11th col 5th row, 6 col wide 4 row deep */
.grid39 { grid-start: "col" 6; grid-end: span 1; grid-before: "row" 5; grid-after: span 2 "gutter"; } /*  6th col 5th row, 1 col wide 2 row deep */
.grid40 { grid-start: "col" 6; grid-end: span 2 "gutter"; grid-before: "row" 7; grid-after: span 2 "gutter"; } /*  6th col 7th row, 2 col wide 2 row deep */
.grid41 { grid-start: "col" 2; grid-end: span 3 "gutter"; grid-before: "row" 5; grid-after: span 3 "gutter"; } /*  2nd col 5th row, 4 col wide 4 row deep */
.grid42 { grid-start: "col" 8; grid-end: span 3 "gutter"; grid-before: "row" 8; grid-after: span 1; } /*  8th col 8th row, 3 col wide 1 row deep */
.grid43 { grid-start: "col" 8; grid-end: span 3 "gutter"; grid-before: "row" 5; grid-after: span 3 "gutter";} /*  8th col 5th row, 3 col wide 3 row deep */
.grid44 { grid-start: "col" 7; grid-end: span 1; grid-before: "row" 5; grid-after: span 1; } /*  7th col 5th row, 1 col wide 1 row deep */
.grid45 { grid-start: "col" 7; grid-end: span 1; grid-before: "row" 6; grid-after: span 1; } /*  7th col 6th row, 1 col wide 1 row deep */
              
            
!

JS

              
                
              
            
!
999px

Console