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 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

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

              
                <div class="grid">
	<div class="grid__heading">
		<h1>Heading</h1>
	</div>
	<div class="grid__media">
	</div>
	<div class="grid__body">
		<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
	</div>
	
</div>

<div class="grid grid--text-bottom">
	<div class="grid__heading">
		<h1>Heading</h1>
	</div>
	<div class="grid__media">
	</div>
	<div class="grid__body">
		<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas purus metus, venenatis egestas diam tempus, venenatis ornare sem. Duis maximus erat eget dui aliquet tempor id nec arcu.</p>
	</div>
</div>

<div class="grid grid--text-bottom">
	<div class="grid__heading">
		<h1>Heading</h1>
	</div>
	<div class="grid__media">
	</div>
	<div class="grid__body">
		<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas purus metus, venenatis egestas diam tempus, venenatis ornare sem. Duis maximus erat eget dui aliquet tempor id nec arcu.</p>
	</div>
</div>

<div class="grid">
	<div class="grid__heading">
		<h1>Heading</h1>
	</div>
	<div class="grid__media">
	</div>
	<div class="grid__body">
		<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas purus metus, venenatis egestas diam tempus, venenatis ornare sem. Duis maximus erat eget dui aliquet tempor id nec arcu.</p>
	</div>
</div>
              
            
!

CSS

              
                * {
	box-sizing: border-box;
}

h1, p {
	margin: 0;
}

body {
	padding: 20px;
	background: black;
}

img {
	display: block;
	width: 100%;
}

.grid {
  --noOfColumns: 8;
  --colWidth: 1fr;
  --gutter: 20px;

  @media (min-width: 900px) {
		--colWidth: 60px;
    --noOfColumns: 12;
  }

  @media (min-width: 1200px) {
    --noOfColumns: 24;
  }

  @media (min-width: 1600px) {
    --colWidth: 40px;
		--gutter: 30px;
  }
}

.grid {
	@media (min-width: 700px) {
		display: grid;
		grid-template-columns: 
			[outer-start]
			minmax(20px, 1fr)
			[wrapper-start] 
			repeat(var(--noOfColumns), minmax(0, var(--colWidth)))
			[wrapper-end]
			minmax(20px, 1fr)
			[outer-end];
		grid-template-rows: [text-start] 1fr [media-start] auto [text-end] 40px [heading-start] auto [heading-end] 40px auto [media-end];
		gap: 0 var(--gutter);
	}
	
	border: 2px solid hotPink;
	margin: 0 0 80px 0;
}


.grid--text-bottom {
	grid-template-rows: [media-start] auto 40px
      [heading-start] auto [heading-end] 
      40px [text-start] auto [media-end] 
      1fr [text-end];
	
	.grid__body {
		align-self: flex-end;
	}
}

.grid__heading,
.grid__media {
	grid-column: var(--start) / var(--end);
}

.grid__heading {
	--start: wrapper-start;
	--end: wrapper-end;
	grid-row: heading;
	z-index: 1;
	text-align: center;
	font-size: 2em;
	line-height: 1;
	letter-spacing: 0.06em;
	background-color: #B0BEC5;
	text-transform: uppercase;
	padding: 10px;
	
	@media (min-width: 1200px) {
		--start: 5;
		--end: -5;
	}
}

.grid__media {
	--start: wrapper-start;
	--end: 6;
	
	grid-row: media;
	height: 300px;
	background-color: #78909C;
	
	@media (min-width: 1200px) {
		--end: 15;
		
		height: 400px;
	}
}

.grid__body {
	--span: 4;
	--end: wrapper-end;
	grid-column: span var(--span) / var(--end);
	grid-row: text;
	align-self: flex-start;
	background-color: #607D8B;
	
	@media (min-width: 900px) {
		--span: 5;
	}
	
	@media (min-width: 1200px) {
		--span: 8;
	}
}


.grid:nth-child(2) {
	.grid__media {
		--start: 6;
		--end: outer-end;
		
		@media (min-width: 900px) {
			--start: 9;
		}
		
		@media (min-width: 1200px) {
			--start: 12;
			--end: outer-end;
		}
	}
	
	.grid__body {
		grid-column: wrapper-start / span var(--span);
	}
}

.grid:nth-child(3) {
	.grid__media {
		@media (min-width: 1200px) {
			--start: outer-start;
			--end: 12;
		}
	}
	
	.grid__body {
		--end: -4;
	}
}

.grid:nth-child(4) {
	.grid__media {
		--start: 6;
		--end: wrapper-end;
		
		@media (min-width: 900px) {
			--start: 9;
		}
		
		@media (min-width: 1200px) {
			--start: 16;
		}
	}
	
	.grid__body {
		grid-column: 4 / span var(--span);
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console