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 class="grid">
  <div>Col-1</div>
  <div style="--col: 2">Col-2</div>
  <div style="--col: 2">
		<div class="grid">
			<div style="--col: 1">Col-2</div>
			<div style="--col: 3">Subcol-3</div>
			<div style="--col: 3">Subcol-3</div>
			<div style="--col: 3">
				<div class="grid">
					<div style="--col: 1">Subcol-3</div>
					<div style="--col: 2">SSC-2</div>
					<div style="--col: 2">SSC-2</div>
				</div>
			</div>
		</div>
	</div>
  <div style="--col: 3">Col-3</div>
  <div style="--col: 3">Col-3</div>
  <div style="--col: 3">Col-3</div>
  <div style="--col: 4">Col-4</div>
  <div style="--col: 4">Col-4</div>
  <div style="--col: 4">Col-4</div>
  <div style="--col: 4">Col-4</div>
  <div style="--col: 5">Col-5</div>
  <div style="--col: 5">Col-5</div>
  <div style="--col: 5">Col-5</div>
  <div style="--col: 5">Col-5</div>
  <div style="--col: 5">Col-5</div>
  <div>Col-1</div>
</div>
              
            
!

CSS

              
                :root {
  --gutter: 2.4rem;
	// Computed vars
  --gutter-half: calc( var(--gutter) / 2 );
  --gutter-double: calc( var(--gutter) * 2 );
}

.grid {
  --col: 1; // default is fullwidth columns
  display: flex;
  flex-wrap: wrap;
	flex-direction: row;
	
	// Negative margins (get rid of extra, outer columns margins)
	margin: calc( 0rem - var(--gutter-half) ); // omg!

	// All direct grid children are implicit columns
	> * {
		// Sizing politic
		flex-grow: 1;
		flex-shrink: 1;
		
		// Mobile-first: full width wolumns
		// Vars in calc()! This isn't doable in Sass!
	  flex-basis: calc(100% - var(--gutter) );
		
		// Large screen layout
		@media screen and (min-width: 30em) {
		  flex-basis: calc(100% / var(--col) - var(--gutter) );
		}

		// Gutter
		margin: var(--gutter-half);
		
		outline: 0.1rem solid beige; // demo
		background-color: #444;
	}
}


// DEMO

html {
	font-size: 62.5%;
}

body {
	font-size: 1.6rem;
	color: beige;
	background-color: brown;
	padding: var(--gutter-double);
}
              
            
!

JS

              
                
              
            
!
999px

Console