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

              
                 <section class="u-bg--green">
	<p class="u-color--dark u-padding u-contained">
		Lorem ipsum dolor sit amet, consectetur adipiscing elit, <a href="#">sed do eiusmod tempor incididunt</a> ut labore et dolore magna aliqua. Aliquam sem fringilla ut morbi tincidunt. <a href="#">Maecenas accumsan</a> lacus vel facilisis. Posuere sollicitudin aliquam ultrices sagittis orci a scelerisque purus semper.
	</p>
</section>

<section class="u-bg--dark">
	<p class="u-color--grey u-padding u-contained">
		Lorem ipsum dolor sit amet, consectetur adipiscing elit, <a href="#">sed do eiusmod tempor incididunt</a> ut labore et dolore magna aliqua. Aliquam sem fringilla ut morbi tincidunt. <a href="#">Maecenas accumsan</a> lacus vel facilisis. Posuere sollicitudin aliquam ultrices sagittis orci a scelerisque purus semper.
	</p>
</section>

<section class="u-bg--light">
	<p class="u-color--dark u-padding u-contained">
		Lorem ipsum dolor sit amet, consectetur adipiscing elit, <a href="#">sed do eiusmod tempor incididunt</a> ut labore et dolore magna aliqua. Aliquam sem fringilla ut morbi tincidunt. <a href="#">Maecenas accumsan</a> lacus vel facilisis. Posuere sollicitudin aliquam ultrices sagittis orci a scelerisque purus semper.
	</p>
</section>

<section style="background-color: #fff; color: #000;">
	<p class="u-padding u-contained">
		What happens if you don't use utility classes to apply the colours? <a href="#">See for yourself!</a> All that you need to do is define a sensible default for your variables.
	</p>
</section>
              
            
!

CSS

              
                html {
	// Set default colors
	--bg: #fff;
	--c: #000;
}

// Define a named list of our colors
$colors: (
	'green': #08ffc8,
	'light': #fff7f7,
	'grey': #dadada,
	'dark': #204969
);

// Loop over each color, where $n is the name (or key), $c is the color value
@each $n, $c in $colors {
	.u-color--#{$n} {
    --c: #{$c};
    color: #{$c};
	}

	.u-bg--#{$n} {
    --bg: #{$c};
    background-color: #{$c};
	}
}

// Define our default link style
a {
	// Styles for older browsers	
	text-decoration: underline;
	color: inherit;
	
	&:hover,
	&:focus,
	&:active {
		text-decoration: none;
		outline: .0625em solid currentColor;
		outline-offset: .0625em;
	}
	
	&:active {
    outline-width: .125em;
	}

	@supports (--a: b) {
		--space: .125em;
		--link-color: currentColor;
		--bg-size: var(--space);
		--shadow-size: 0;
    
    padding: var(--space); // Inline elements won't affect vertical rhythm, so we don't need to specify each direction
		
		color: var(--link-color); // Use the variable for our color
		text-decoration: none; // Remove the default underline
		
    border-radius: var(--space); // Make it a tiny bit fancier ✨
    background-image: linear-gradient(var(--c, currentColor), var(--c, currentColor));
    background-repeat: repeat-x;
    background-position: 0 100%;
    background-size: 100% var(--bg-size);
    box-shadow: 0 0 0 var(--shadow-size, 0) var(--c, currentColor); // Used in the :active state
    box-decoration-break: clone; // Ensure the styles repeat on links spaning multiple lines
    
    transition-property: color, background-size, box-shadow;
    transition-duration: 150ms;
    transition-timing-function: ease-in-out;
    will-change: color, background-size, box-shadow;
	  
		&:link,
    &:visited {
			--link-color: var(--c, currentColor); // Use --c, or fallback to currentColor
		}
    
    &:hover,
    &:focus,
    &:active {
      --bg-size: 100%;
      --link-color: var(--bg);
			outline: none; // Remove the fallback style
    }
    
    &:active {
      --shadow-size: var(--space); // Define the box-shadow size
    }
	}
}

// Other utility classes
.u-contained {
  max-width: 60ch;
  margin: 0 auto;
}

.u-padding { padding: 1rem; }

// Resets…
* { 
  margin: 0;
  line-height: 1.4em;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}
              
            
!

JS

              
                
              
            
!
999px

Console