Pen Settings



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


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


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.


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.


                <div class="contain">
  <div class="range">
    <label for="range">Drag to change parent font-size:</label>
    <input type="range" name="" id="range" min="10" max="40" />
    <span class="current"></span>

<div class="item">
  <p>This hero section items could be resized easily by changing the parent font size</p>
  <div class="hero">
    <h2>This is title for this hero section</h2>
    <p>And this paragraph is a sub title, as you know I'm writing an article about using <code>em</code> unit to build dynamic components

    <a href="#">Read about hero</a>


                $browser-context: 16; // Default
$color-brand: #4a90e2;

body {
	font-family: 'Arial';

.contain {
	max-width: 1000px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 1em;
	padding-right: 1em;

.range {
  padding-top: 2em;
  margin-bottom: 2em;
  label {
    display: block;
    margin-bottom: 10px;

@function em($pixels, $context: $browser-context) {
  @return #{$pixels/$context}em;

/* Sass function credit: */

/*** Demo Code ***/

.hero {
	background: #ececec;
	padding: 1.5em;
  > * {
    outline: 1px solid grey;
    background: lightgrey;

	p {
		margin: 0;
		padding: 0;

	h2 {
		margin-bottom: 0.25em;
		font-size: 1.75em;

	p {
		margin-bottom: 1em;
		max-width: em(450);
		font-size: 1.25em;

	a {
		display: inline-block;
		background: $color-brand;
		color: #fff;
		padding: 0.7em 1.5em;
		text-decoration: none;


                var slider = document.querySelector('#range');
    item = document.querySelector('.item'),
    current = document.querySelector('.current'),
    style = window.getComputedStyle(item, null).getPropertyValue('font-size'),
    fontSize = parseFloat(style);

current.innerHTML = fontSize + "px";

range.addEventListener('input', function() {
  var newValue = this.value + "px"; = newValue;
  current.innerHTML = newValue;