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

              
                <figure>
	<img src="https://assets.codepen.io/15542/sad.jpg" alt="dissaponted child in pigtails and stripes frowning at us" />
	<figcaption>
		Dissapointed child can't believe I stole this.
		I tried to apologize,
		but she's not interested in excuses.
	</figcaption>
</figure>
<main>
	<h1>I stole this demo</h1>
	<p>
		Heydon Pickering & Andy Bell
		call this 
		<a href="https://every-layout.dev/layouts/sidebar/">The Sidebar</a>
		on <strong>Every Layout</strong>.
		Andy wrote a bit 
		about the pattern recently on
		<a href="https://piccalil.li/blog/if-it-works-its-right/">
			Piccalilli blog</a>, 
		and how it works to generate layouts
		from the inside out.
	</p>
	<p>
		It seems to work using
		either <code>min-inline-size</code>
		or <code>flex-basis</code>
		for the 'ideal' (<code>50%</code>) 
		size of the main area.
	</p>
</main>
              
            
!

CSS

              
                body {
	display: flex;
	gap: 1lh min(1lh, 2cqi);
	flex-flow: wrap;
}

figure {
	flex: 1 1 15em;
}

main {
	flex: 999 0 0;
	min-inline-size: 50%;
/* 	flex: 999 0 50%; */
}


@layer setup {
	* { box-sizing: border-box; }
	
	html { 
		block-size: 100%;
		font-size: max(1em, 24px); 
	}
	body { 
		margin: unset;
		min-block-size: 100%; 
	}

	figure { 
		border: thick solid MediumVioletRed; 
		margin: unset;
	}
	
	main { border: thick solid teal; }
	
	body, figure, main {
		padding: min(1lh, 2cqi);
	}
	
	h1 { margin: unset; }
	
	img {
		max-inline-size: 100%;
		block-size: auto;
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console