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

              
                <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