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 id="seasons">
	<div id="winterintospring">
		<div class="">Winter into Spring&nbsp;1</div>
		<div>Winter into Spring&nbsp;2</div>
		<div>Winter into Spring&nbsp;3</div>
		<div>Winter into Spring&nbsp;4</div>
		<div>Winter into Spring&nbsp;5</div>
		<div>Winter into Spring&nbsp;6</div>
		<div>Winter into Spring&nbsp;7</div>
		<div>Winter into Spring&nbsp;8</div>
	</div>
	<div id="summer">
		<div>Summer&nbsp;1</div>
		<div>Summer&nbsp;2</div>
		<div>Summer&nbsp;3</div>
		<div>Summer&nbsp;4</div>
	</div>
	<div id="autumn">Autumn</div>
</div>
              
            
!

CSS

              
                /* outer -ms-grid */

#seasons,
#winterintospring,
#summer
{
	display: -ms-grid;
}

#seasons
{
	-ms-grid-rows: (1fr 0.25rem)[3] auto;
	-ms-grid-columns: 1fr;
}

#winterintospring
{
	-ms-grid-row-span: 3;
	
	-ms-grid-rows: (1fr 0.25rem)[3] 1fr;
	-ms-grid-columns: 1fr 0.25rem 1fr;
}

#summer
{
	-ms-grid-row: 5;
	
	-ms-grid-rows: 1fr 0.25rem 1fr;
	-ms-grid-columns: 1fr 0.25rem 1fr;
}

#autumn
{
	-ms-grid-row: 7;
}

@media (min-width: 36em)
{
	#seasons
	{
		-ms-grid-rows: 1fr 0.25rem 1fr;
		-ms-grid-columns: 1fr 0.25rem 1fr;
	}
	
	#winterintospring
	{
		-ms-grid-row-span: 1;
		-ms-grid-column-span: 3;
	
		-ms-grid-rows: 1fr 0.25rem 1fr;
		-ms-grid-columns: (1fr 0.25rem)[3] 1fr;
	}

	#summer
	{
		-ms-grid-row: 3;
	}

	#autumn
	{
		-ms-grid-row: 3;
		-ms-grid-column: 3;
	}
}

@media (min-width: 48em)
{
	#seasons
	{
		-ms-grid-rows: 1fr 0.25rem auto;
		-ms-grid-columns: 2fr 0.25rem 1fr;
	}
	
	#winterintospring
	{
		-ms-grid-column-span: 1;
	}

	#summer
	{
		-ms-grid-row: 1;
		-ms-grid-column: 3;
	}

	#autumn
	{
		-ms-grid-row: 3;
		-ms-grid-column: 1;
		-ms-grid-column-span: 7;
	}
}

/* inner -ms-grid */

.double:first-child,
#summer .double:nth-child(3)
{
	-ms-grid-column-span: 3;
}

.large:first-child
{
	-ms-grid-row-span: 3;
	-ms-grid-column-span: 3;
}

#winterintospring > :nth-child(2),
#summer > :nth-child(2)
{
	-ms-grid-row: 1;
	-ms-grid-column: 3;	
}

#winterintospring > :nth-child(3),
#winterintospring > .double:first-child ~ :nth-child(2),
#summer > :nth-child(3)
{
	-ms-grid-row: 3;
	-ms-grid-column: 1;	
}

#winterintospring > :nth-child(4),
#winterintospring > .double:first-child ~ :nth-child(3),
#summer > :nth-child(4)
{
	-ms-grid-row: 3;
	-ms-grid-column: 3;	
}

#winterintospring > :nth-child(5),
#winterintospring > .double:first-child ~ :nth-child(4),
#winterintospring > .large:first-child ~ :nth-child(2)
{
	-ms-grid-row: 5;
	-ms-grid-column: 1;	
}

#winterintospring > :nth-child(6),
#winterintospring > .double:first-child ~ :nth-child(5),
#winterintospring > .large:first-child ~ :nth-child(3)
{
	-ms-grid-row: 5;
	-ms-grid-column: 3;	
}

#winterintospring > :nth-child(7),
#winterintospring > .double:first-child ~ :nth-child(6),
#winterintospring > .large:first-child ~ :nth-child(4)
{
	-ms-grid-row: 7;
	-ms-grid-column: 1;	
}

#winterintospring > :nth-child(8),
#winterintospring > .double:first-child ~ :nth-child(7),
#winterintospring > .large:first-child ~ :nth-child(5)
{
	-ms-grid-row: 7;
	-ms-grid-column: 3;	
}

@media (min-width: 36em)
{
	#winterintospring > :nth-child(3),
	#winterintospring > .double:first-child ~ :nth-child(2),
	#winterintospring > .large:first-child ~ :nth-child(2)
	{
		-ms-grid-row: 1;
		-ms-grid-column: 5;	
	}

	#winterintospring > :nth-child(4),
	#winterintospring > .double:first-child ~ :nth-child(3),
	#winterintospring > .large:first-child ~ :nth-child(3)
	{
		-ms-grid-row: 1;
		-ms-grid-column: 7;	
	}
	
	#winterintospring > :nth-child(5),
	#winterintospring > .double:first-child ~ :nth-child(4)
	{
		-ms-grid-row: 3;
		-ms-grid-column: 1;	
	}

	#winterintospring > :nth-child(6),
	#winterintospring > .double:first-child ~ :nth-child(5)
	{
		-ms-grid-row: 3;
		-ms-grid-column: 3;	
	}

	#winterintospring > :nth-child(7),
	#winterintospring > .double:first-child ~ :nth-child(6),
	#winterintospring > .large:first-child ~ :nth-child(4)
	{
		-ms-grid-row: 3;
		-ms-grid-column: 5;	
	}

	#winterintospring > :nth-child(8),
	#winterintospring > .double:first-child ~ :nth-child(7),
	#winterintospring > .large:first-child ~ :nth-child(5)
	{
		-ms-grid-row: 3;
		-ms-grid-column: 7;	
	}
}

/* outer & inner grids */

#seasons,
#winterintospring,
#summer
{
	display: grid;	
	grid-gap: 0.25rem;
}

#seasons
{
	grid-template: repeat(3, 1fr) auto / 1fr;
	grid-template-areas:
		"winterintospring"
		"winterintospring"
		"summer"
		"autumn";
}

#winterintospring
{
	grid-area: winterintospring;
	grid-template: repeat(4, 1fr) / repeat(2, 1fr);
}

#summer
{
	grid-area: summer;
	grid-template: repeat(2, 1fr) / repeat(2, 1fr);
}

#autumn
{
	grid-area: autumn;
}

@media (min-width: 36em)
{
	#seasons
	{
		grid-template: repeat(2, 1fr) / repeat(2, 1fr);
		grid-template-areas:
			"winterintospring winterintospring"
			"summer           autumn";
	}
	
	#winterintospring
	{
		grid-template: repeat(2, 1fr) / repeat(4, 1fr);
	}
}

@media (min-width: 48em)
{
	#seasons
	{
		grid-template: 1fr auto / 2fr 1fr;
		grid-template-areas:
			"winterintospring summer"
			"autumn           autumn";
	}
}

.double:first-child,
#summer .double:nth-child(3)
{
	grid-column-end: span 2;
}

.large:first-child
{
	grid-column-end: span 2;
	grid-row-end: span 2;
}

.double:first-child ~ :last-child,
#summer .double:nth-child(3) ~ :last-child,
.large:first-child ~ :nth-last-child(3),
.large:first-child ~ :nth-last-child(3) ~ *
{
	display: none !important;
}

/* other stuff */

#seasons > * > *,
#autumn
{
	padding: 0.5rem;
	overflow: hidden;
	font: 2em/1 LiebeDoris, Calibri;	
}

#seasons > * > *
{
	display: flex;
	align-items: flex-end;
}

#winterintospring > *
{
	background: hsl(100, 50%, 50%);
	background: hsl(100deg 50% 50%);
}

#summer > *
{
	background: hsl(50, 80%, 60%);
	background: hsl(50deg 80% 60%);
}

#autumn
{
	background: hsl(20, 70%, 50%);
	background: hsl(20deg 70% 50%);
}


              
            
!

JS

              
                (function ()
{
	function adjustHeight()
	{
		const summerElement = document.querySelector('#summer');
		summerElement.style.height = summerElement.offsetWidth + 'px';
	}

	document.addEventListener('DOMContentLoaded', adjustHeight);
	window.addEventListener('resize', adjustHeight);
})();


              
            
!
999px

Console