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

              
                <div class="grid grid--text-bottom grid--img-r">
	<div class="grid__heading">
		<h1>Get ready</h1>
	</div>
	<div class="grid__media">
		<img src="https://images.unsplash.com/photo-1506043959821-2eda767099c8?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=8516f569db6d6ddcbc8daae137d08216&auto=format&fit=crop&w=1567&q=80" alt="A nice mountain landscape with trees">
	</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="wrapper">
	<h3>Normal text are inside a wrapper that aligns to the grid content</h3>
	<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 class="grid">
	<div class="grid__heading">
		<h1>for new adventures</h1>
	</div>
	<div class="grid__media">
		<img src="https://images.unsplash.com/photo-1506043959821-2eda767099c8?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=8516f569db6d6ddcbc8daae137d08216&auto=format&fit=crop&w=1567&q=80" alt="A nice mountain landscape with trees">
	</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--narrow-img-r">
	<div class="grid__heading">
		<h1>Heading</h1>
	</div>
	<div class="grid__media">
		<img src="https://images.unsplash.com/photo-1506043959821-2eda767099c8?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=8516f569db6d6ddcbc8daae137d08216&auto=format&fit=crop&w=1567&q=80" alt="A nice mountain landscape with trees">
	</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 grid--narrow">
	<div class="grid__heading">
		<h1>Component with smaller image</h1>
	</div>
	<div class="grid__media">
		<img src="https://images.unsplash.com/photo-1506043959821-2eda767099c8?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=8516f569db6d6ddcbc8daae137d08216&auto=format&fit=crop&w=1567&q=80" alt="A nice mountain landscape with trees">
	</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;
}

p, h1 {
	margin: 0;
}

h1 {
	text-transform: uppercase;
	letter-spacing: .05em;
}

body {
	background: #1f2021;
	color: white;
}

$wrapper-width: 1200px;
$max-col: calc(((1200px - (20px * 25)) / 24)); // width of wrapper - (gutter width x number of gutters) / numbers of columns (not including padding columns). This gives us the width of each of our main columns after the $wrapper-width breakpoint.

.grid {
	display: grid;
	grid-template-columns: [outer-start] 20px [wrapper-start padding-l] repeat(24, 1fr) [wrapper-end padding-r] 20px [outer-end];
	grid-template-rows: [outer-start] 1fr [text-top-end] 40px [heading-start] auto [heading-end] 40px [text-bottom-start] 1fr [outer-end];
	// I need to add a 40px row rather than using the grid-row-gap property as grid-row-gap adds vertical spacing above and below image, so text is out of alignment
	grid-gap: 0 20px;
	border: 1px solid #35383a;
	margin: 10px 10px 60px 10px;
	
	@media (min-width: $wrapper-width) {
		grid-template-columns: [outer-start] 20px [padding-l] 1fr [wrapper-start] repeat(24, $max-col) [wrapper-end] 1fr [padding-r] 20px [outer-end];
	}
	
	> * {
		border: 2px solid hotPink;
	}
}

.grid__heading {
	grid-column: wrapper-start / wrapper-end;
	grid-row: heading-start / heading-end;
	z-index: 1;
	text-align: center;
	font-size: 2em;
}

.grid__body {
	grid-column: span 7 / wrapper-end;
	grid-row: outer-start / text-top-end;
	align-self: flex-start;
}

.grid__media {
	grid-column: outer-start / 15;
	grid-row: outer-start / outer-end;
	align-self: center;
	
	img {
		display: block;
		width: 100%;
	}
}

.grid--narrow {
	.grid__media {
		grid-column: wrapper-start / 19;
	}
}

.grid--narrow-img-r {
	.grid__media {
		grid-column: 12 / wrapper-end;
	}
	
	.grid__body {
		grid-column: wrapper-start / span 7;
	}
}

.grid--text-bottom {
	.grid__body {
		grid-row: text-bottom-start / outer-end;
		align-self: flex-end;
	}
}

.grid--img-r {
	.grid__media {
		grid-column: 16 / outer-end;
	}
	
	.grid__body {
		grid-column: wrapper-start / span 7;
	}
}

.wrapper {
	max-width: $wrapper-width;
	margin: 0 auto 40px auto;
	padding: 0 20px;
}
              
            
!

JS

              
                
              
            
!
999px

Console