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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <!--Content: https://branch.climateaction.tech/-->
<main>
	<div class="grid">
		<div class="grid__item-wrapper">
			<div class="card">
				<img src='https://images.unsplash.com/photo-1576403103737-dc646cbf7de5?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTI3ODcyMjI&ixlib=rb-1.2.1&q=80&w=400' alt='Large globe'>
				<div class="card__inner">
					<h3>We Don’t Have the Right: A Decolonized Approach to Innovation</h3>
					<p>Shayna Robinson</p>
					<a href="">Read the article</a>
				</div>
			</div>
		</div>
		<div class="grid__item-wrapper">
			<div class="card">
				<img src='https://images.unsplash.com/photo-1509390981263-4d8df07d826c?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTI3ODYzNzc&ixlib=rb-1.2.1&q=80&w=400' alt='Wind turbines'>
				<div class="card__inner">
					<h3>We Need a Fossil-Free Internet by 2030</h3>
					<p>Chris Adams</p>
					<a href="">Read the article</a>
				</div>
			</div>
		</div>
		<div class="grid__item-wrapper">
			<div class="card">
				<img src='https://images.unsplash.com/photo-1522125670776-3c7abb882bc2?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NjEyODY3MzQ&ixlib=rb-1.2.1&q=80&w=400' alt='Hands holding smartphone'>
				<div class="card__inner">
					<h3>Carbon Footprint of Unwanted Data-Use by Smartphones</h3>
					<p>CE Delft</p>
					<a href="">Read the article</a>
				</div>
			</div>
		</div>
	</div>
</main>
<aside>
	<div class="grid">
		<div class="grid__item-wrapper">
			<div class="card">
				<img src='https://images.unsplash.com/photo-1616443586071-cd1f0a65ef5e?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NjEyODY2NzE&ixlib=rb-1.2.1&q=80&w=400' alt='Leafless tree in a desert'>
				<div class="card__inner">
					<h3>The Handbook Every Worker in Tech Needs to Read</h3>
					<p>Ifeoma Ozoma</p>
					<a href="">Read the article</a>
				</div>
			</div>
		</div>
		<div class="grid__item-wrapper">
			<div class="card">
				<img src='https://images.unsplash.com/photo-1524463863790-4c419da22456?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NjEyODY3OTM&ixlib=rb-1.2.1&q=80&w=400' alt='Wind turbines on green field'>
				<div class="card__inner">
					<h3>Green Tech: What Solutions Are Being Advocated?</h3>
					<p>Anne Currie</p>
					<a href="">Read the article</a>
				</div>
			</div>
		</div>
	</div>
</aside>
              
            
!

CSS

              
                @layer general, layout;

@layer layout {
	main, aside {
		container: layout / inline-size;
	}
	
	.grid__item-wrapper {
		container: card / inline-size;
	}
	
	@container layout (inline-size > 40em) {
		.grid {
			grid-template-columns: repeat(2, 1fr);
		}
	}
	
	@container card (inline-size > 24em) {
		.card {
			flex-direction: row;
		}
		
		.card img {
			width: 40%;
			flex: 1 1 auto;
		}
	}
}

@layer general {
	* {
		box-sizing: border-box;
	}

	body {
		--pad: clamp(1rem, 2vw, 3rem);
		--pad-lg: calc(var(--pad) * 2);
		--pad-sm: calc(var(--pad) / 2);
		--pad-xs: calc(var(--pad) / 4);
		margin: 0;
		font-family: 'Exo 2', sans-serif;
		background: lightblue;
		min-height: 100vh;
	}

	img {
		width: 100%;
		display: block;
		aspect-ratio: 3 / 2;
		object-fit: cover;
	}

	main,
	aside {
		padding: var(--pad);
	}

	aside {
		background: cornflowerblue;
	}

	@media (min-width: 60em) {
		body {
			display: grid;
			grid-template-columns: 1fr min(20rem, 50%);
		}
	}

	p,
	h3 {
		margin: 0;
	}

	.card__inner h3 {
		margin: 0 0 var(--pad-xs);
	}

	.card__inner p {
		margin: 0 0 var(--pad-sm);
	}

	.grid {
		display: grid;
		gap: var(--pad);
		margin: 0 auto;
		max-width: 65rem;
		padding: var(--pad);
	}

	@media (min-width: 75em) {
		.grid {
			border: 0.2rem solid aliceblue;
			padding: var(--pad);
		}
	}

	.card {
		width: 100%;
		height: 100%;
		border-radius: var(--pad);
		border: 0.2rem solid;
		position: relative;
		overflow: hidden;
		display: flex;
		flex-direction: column;
		box-shadow: 0.1rem 0.1rem 1rem rgb(0 0 0 / 0.15);
	}

	.card__inner {
		padding: var(--pad-sm);
		flex-grow: 1;
	}

	.card__top {
		padding: 0.75rem 1rem;
		background: var(--c, deeppink);
	}

	.card__inner {
		display: flex;
		flex-direction: column;
		background: white;
	}

	.card__top {
		color: white;
		font-weight: 700;
	}

	.card__inner > * + * {
		margin-top: var(--pad-sm);
	}

	.card__inner a {
		margin-top: auto;
		color: inherit;
		font-size: 0.9rem;
	}

	[style="--c: turquoise"] .card__top,
	[style="--c: orange"] .card__top {
		color: black;
	}
}



              
            
!

JS

              
                if (!("container" in 		document.documentElement.style)) {
  import("https://unpkg.com/container-query-polyfill@^0.2.2");
}
              
            
!
999px

Console