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

              
                	<div class="wrapper">
<!-- row 1, 4 individual boxes -->
		<div class="row">
			<article class="col-1-2">
				<h3>Boston Cream Pie</h3>
			    <img src="https://loremflickr.com/250/150/pie" alt="Boston creme pie.">
			    <p>Boston's famous dessert, a combination of yellow cake, vanilla pudding, and chocolate frosting.</p>
			    <p><a href="http://www.foodnetwork.com/recipes/boston-cream-pie-recipe0-1908702">Read more &gt;&gt;</a></p>
			</article>
			<article class="col-1-2">
		    	<h3>Coconut Cream Pie</h3>
		    	<img src="https://loremflickr.com/250/150/cake" alt="Coconut cream pie.">
		    	<p>Coconut cream pie will take you to an island escape. Especially delicious in winter.</p>
		    	<p><a href="https://www.favfamilyrecipes.com/coconut-cream-pie-2/">Read more &gt;&gt;</a></p>
		    </article>
		    <article class="col-1-2">
		    	<h3>Key Lime Pie</h3>
		    	<img src="https://loremflickr.com/250/150/cupcake" alt="Key lime pie.">
		    	<p>Key lime pie is based on the tiny key limes from Florida. These limes are less sour than conventional limes. </p>
		    	<p><a href="https://www.epicurious.com/recipes/food/views/key-lime-pie-108125" target="_blank">Read more &gt;&gt;</a></p>
		    </article>
		    <article class="col-1-2">
		    	<h3>Pumpkin Pie</h3>
		    	<img src="https://loremflickr.com/250/150/chocolate" alt="Pumpkin pie.">
		    	<p>A staple of every Thanksgiving dinner table, pumpkin pie is delicious any time of year.</p>
		    	<p><a href="http://www.kingarthurflour.com/recipes/pumpkin-pie-recipe" target="_blank">Read more &gt;&gt;</a></p>
		    </article>
		</div>
<!-- row 2, 2 boxes spanning 2 rows -->
		<div class="row">
		    <article class="col-2">
		    	<h3>Key Lime Pie</h3>
		    	<img src="https://loremflickr.com/250/150/cupcake" alt="Key lime pie.">
		    	<p>Key lime pie is based on the tiny key limes from Florida. These limes are less sour than conventional limes. </p>
		    	<p><a href="https://www.epicurious.com/recipes/food/views/key-lime-pie-108125" target="_blank">Read more &gt;&gt;</a></p>
		    </article>
		    <article class="col-2">
		    	<h3>Pumpkin Pie</h3>
		    	<img src="https://loremflickr.com/250/150/chocolate" alt="Pumpkin pie.">
		    	<p>A staple of every Thanksgiving dinner table, pumpkin pie is delicious any time of year.</p>
		    	<p><a href="http://www.kingarthurflour.com/recipes/pumpkin-pie-recipe" target="_blank">Read more &gt;&gt;</a></p>
		    </article>
		</div>
<!-- row 3: narrow left column, wide right/content column -->
		<div class="row">
			<article class="col-1-4">
				<h3>Boston Cream Pie</h3>
			    <img src="https://loremflickr.com/250/150/pie" alt="Boston creme pie.">
			    <p>Boston's famous dessert, a combination of yellow cake, vanilla pudding, and chocolate frosting.</p>
			    <p><a href="http://www.foodnetwork.com/recipes/boston-cream-pie-recipe0-1908702">Read more &gt;&gt;</a></p>
			</article>
			<article class="col-3">
		    	<h3>Coconut Cream Pie</h3>
		    	<img src="https://loremflickr.com/250/150/cake" alt="Coconut cream pie.">
		    	<p>Coconut cream pie will take you to an island escape. Especially delicious in winter.</p>
		    	<p><a href="https://www.favfamilyrecipes.com/coconut-cream-pie-2/">Read more &gt;&gt;</a></p>
		    </article>
		</div>
<!-- row 4: one column -->
		<div class="row">
			<article class="col-4">
				<h3>Boston Cream Pie</h3>
			    <img src="https://loremflickr.com/250/150/pie" alt="Boston creme pie.">
			    <p>Boston's famous dessert, a combination of yellow cake, vanilla pudding, and chocolate frosting.</p>
			    <p><a href="http://www.foodnetwork.com/recipes/boston-cream-pie-recipe0-1908702">Read more &gt;&gt;</a></p>
			</article>
		</div>
<!-- row 5: 1-2-1 arrangement -->
		<div class="row">
			<article class="col-2-4 order-1">
		    	<h3>Coconut Cream Pie</h3>
		    	<img src="https://loremflickr.com/250/150/cake" alt="Coconut cream pie.">
		    	<p>Coconut cream pie will take you to an island escape. Especially delicious in winter.</p>
		    	<p><a href="https://www.favfamilyrecipes.com/coconut-cream-pie-2/">Read more &gt;&gt;</a></p>
		    </article>
			<article class="col-1-2 order-2">
				<h3>Boston Cream Pie</h3>
			    <img src="https://loremflickr.com/250/150/pie" alt="Boston creme pie.">
			    <p>Boston's famous dessert, a combination of yellow cake, vanilla pudding, and chocolate frosting.</p>
			    <p><a href="http://www.foodnetwork.com/recipes/boston-cream-pie-recipe0-1908702">Read more &gt;&gt;</a></p>
			</article>
		    <article class="col-1-2 order-3">
		    	<h3>Key Lime Pie</h3>
		    	<img src="https://loremflickr.com/250/150/cupcake" alt="Key lime pie.">
		    	<p>Key lime pie is based on the tiny key limes from Florida. These limes are less sour than conventional limes. </p>
		    	<p><a href="https://www.epicurious.com/recipes/food/views/key-lime-pie-108125" target="_blank">Read more &gt;&gt;</a></p>
		    </article>
		 </div>
	</div>
              
            
!

CSS

              
                /* grid system -- mobile first! */
.row {
		margin: 0;
		display: flex;
		flex-flow: row wrap;
		justify-content: space-between;
  --columns: 4;
	}
[class*="col-"] {
  --width: 4;
  --initialbasis: calc(var(--width, 0) / var(--columns, 4) * 100%);
  --gap: calc((var(--columns) - var(--width)) * 1%);
  flex-basis: calc(var(--initialbasis) - var(--gap));
}

/* Mobile Landscape Screen Sizes */
@media only screen and (min-width: 480px)  {
	.col-1-2,
	.col-2  {
		--width: 2;
	}
	.col-1-4,
	.col-2-4,
	.col-3,
	.col-4 {
		--width: 4;
	}
	.order-2,
	.order-3 {
		order: 2;
	}
	.order-1 {
		order: 1;
	}
}
/* Desktop screen Sizes */
@media only screen and (min-width: 768px) {

	.col-1-2,
	.col-1-4 {
		--width: 1;
	}
	.col-2-4 {
		--width: 2;
	}
	.col-3 {
		--width: 3;		
	}
	.order-3 {
		order: 3;
	}
	.order-2 {
		order: 1;
	}
	.order-1 {
		order: 2;
	}
}


/* default CSS - no need to change anything here. Change colors if you wish */



/* Border box declaration 
https://www.paulirish.com/2012/box-sizing-border-box-ftw/ */
html {
  box-sizing: border-box;
}
*, 
*::before, 
*::after {
  box-sizing: inherit;
}

body {
	font-family: Arial, Geneva, sans-serif;
  margin: 0;
	padding: 0;
}
a {
	color: #2772B0;
}
.wrapper {
	width: 97%;
	max-width: 1200px;
	margin: 0 auto;
	background-color: #fff;
}

img {
	width: 100%;
	max-width: 225px; 
}
.col-1-2,
.col-1-4 {
	background-color: #ffc;
}
.col-2,
.col-2-4 {
	background-color: #fcf;
}
.col-3 {
	background-color: #cff;
}
.col-4 {
	background-color: #ccf;
}

              
            
!

JS

              
                
              
            
!
999px

Console