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

              
                <h1>CSS Grid Diagram: <code>1fr</code> vs. <code>auto</code> for Row Height</h1>
<p>The height of a grid layout can change significantly when using <code>fr</code> for defining the height of rows.</p>
<p><em><small>Built for <a href="https://css-tricks.com/building-a-conference-schedule-with-css-grid/">"Building a Conference Schedule with CSS Grid"</a> on CSS Tricks.</small></em></p>
<h2>Row Height = <code>1fr</code></h2>
<p>Using <code>1fr</code> produces equal-height rows determined by the tallest row in the grid.</p>
<div class="grid-1">
	<div class="row">Time Slot: 8:00-8:30</div>
	<div class="row">Time Slot: 8:30-9:00<br>This is the tallest row.<br>It determines the height of all rows.</div>
	<div class="row">Time Slot: 9:00-9:30</div>
	<div class="row">Time Slot: 9:30-10:00<br>Second Line</div>
	<div class="row">Time Slot: 10:00-10:30</div>
</div>

<h2>Row Height = <code>auto</code></h2>
<p>Using <code>auto</code> makes each row the height of its content.</p>
<div class="grid-2">
	<div class="row">Time Slot: 8:00-8:30</div>
	<div class="row">Time Slot: 8:30-9:00<br>This is the tallest row.<br>It only impacts its own row height.</div>
	<div class="row">Time Slot: 9:00-9:30</div>
	<div class="row">Time Slot: 9:30-10:00<br>Second Line</div>
	<div class="row">Time Slot: 10:00-10:30</div>
</div>
              
            
!

CSS

              
                body {
	max-width: 800px;
	margin: 40px auto;
	padding: 40px 0;
	line-height: 1.65;
}

.grid-1 {
	display: grid;
	grid-template-rows: repeat(5, 1fr);
	margin-bottom: 100px;
}

.grid-2 {
	display: grid;
	grid-template-rows: repeat(5, auto);
}

.row {
	position: relative;
	padding: 1em 0;
	border: 3px dashed purple;
	display: flex;
	justify-content: center;
	align-items: center;
	text-align: center;
	color: #333;
	
	& + .row {
		border-top: 0;
	}
}

h2 {
	margin-bottom: 20px;
	text-align: center;
}

p {
	text-align: center;
	margin-bottom: 40px;
}
              
            
!

JS

              
                
              
            
!
999px

Console