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="grid">
	<div class="grid__item grid__item--heading">
		<h1>Heading</h1>
	</div>
	<div class="grid__item grid__item--body">
		<p>Body</p>
	</div>
	<div class="grid__item grid__item--fig">
		<p>Something else</p>
	</div>
</div>

<div class="grid">
	<div class="grid__item grid__item--fw">
		<p>Content that fits the wrapper – basically a full-width grid item</p>
	</div>
</div>

<div class="grid">
	<div class="grid__item grid__item--heading">
		<h1>Heading</h1>
	</div>
	<div class="grid__item grid__item--body-right">
		<p>Body</p>
	</div>
	<div class="grid__item grid__item--fig-to-edge">
		<p>A figure that bleeds to the edge of the page</p>
	</div>
</div>
              
            
!

CSS

              
                * {
	box-sizing: border-box;
}

:root {
	--wrapper: 100%;
	--col: 1fr;
	--pad: 20px;
	--gutter: 20px;
	--numberOfColumns: 22;
	
	@media (min-width: 1200px) {
		--numberOfColumns: 22;
		--wrapper: 1000px;
		--pad: 1fr;
		--col: calc((var(--wrapper) - ((var(--numberOfColumns) + 1) * var(--gutter))) / var(--numberOfColumns));
	}
	
	@media (min-width: 1600px) {
		--wrapper: 1400px;
	}
}

body {
	background-color: #787A63;
}


.grid {
	max-width: 1200px;
	margin: 40px auto;
	padding: 0 20px;
	
	@media (min-width: 600px) {
		display: flex;
		
		@supports (display: grid) {
			display: grid;
			grid-template-columns: [outer-start] var(--pad) [wrapper-start inner-start] repeat(var(--numberOfColumns), var(--col)) [wrapper-end inner-end] var(--pad) [outer-end];
			grid-template-rows: minmax(auto, 300px);
			grid-gap: var(--gutter);
			max-width: none;
			padding: unset;
			
			&::after,
			&::before {
				content: '';
				display: block;
				width: 100%;
				height: 100%;
				grid-row: 1 / 4;
				opacity: 0.2;
			}
			
			&::after {
				border: 2px dotted black;
				grid-column: wrapper-start / wrapper-end;
			}
			
			&::before {
				content: '';
				display: block;
				width: 100%;
				height: 100%;
				border: 2px solid #F8E8D5;
				grid-column: inner-start / inner-end;
			}
		}
	}
	
	@media (min-width: 1200px) {
		grid-template-columns: [outer-start] var(--pad) [wrapper-start] 1fr [inner-start] repeat(var(--numberOfColumns), var(--col)) [inner-end] 1fr [wrapper-end] var(--pad) [outer-end];
	}
}

.grid__item {
	width: 100%;
	min-height: 200px;
	padding: 20px;
}

.grid__item--heading {
	grid-column: wrapper-start / wrapper-end;
	grid-row: 1;
	background-color: #2E3D34;
	color: #D2C0A7;
}

.grid__item--body {
	grid-column: inner-start / span 12;
	grid-row: 2;
	background-color: #69623B
}

.grid__item--body-right {
	grid-column: span 12 / inner-end;
	grid-row: 2;
	background-color: #69623B
}

.grid__item--fig {
	grid-column: span 16 / inner-end;
	height: 400px;
	grid-row: 3;
	background-color: #D2C0A7;
}

.grid__item--fig-to-edge {
	grid-column: outer-start / 18;
	height: 400px;
	grid-row: 3;
	background-color: #D2C0A7;
}

.grid__item--fw {
	grid-column: wrapper-start / wrapper-end;
	grid-row: 1;
}


              
            
!

JS

              
                
              
            
!
999px

Console