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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                <div class="warning">
  <p>⚠️ Your browser does not support <a href="https://caniuse.com/#feat=aspect-ratio">CSS <code>aspect-ratio</code></a>.</p>
</div>

<iframe src="https://www.youtube.com/embed/e7BkmF8CJpQ" width="560" height="315" style="--aspect-ratio: 560 / 315"></iframe>
              
            
!

CSS

              
                iframe {
  aspect-ratio: var(--aspect-ratio); /* Use the CSS Variable defined aspect ratio */
  width: 100%;
  height: auto;
}

/**
 * If supported, derive the aspect ratio from the height/width attributes.
 * This way iframes will behave like images (which have an intrinsic aspect ratio)
 */
@supports (aspect-ratio: attr(width number) / 1) {
  iframe[width][height] {
    aspect-ratio: attr(width number) / attr(height number);
  }
}









// Non-essential demo styles
* {
	display: border-box;
}

body {
  text-align: center;
  
  // limit width + center self
  width: 50vw;
  margin: 0 auto;
  
  // center contents
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
}

#demo {
  // Abuse flexbox to lign the text in the center of the box
  display: flex;
  align-items: center;
  justify-content: center;
}

.warning {
	margin: 1em 0;
	padding: 1em;
	border: 1px solid #ccc;
}

.warning p {
	margin: 0;
	padding: 0;
}

@supports (aspect-ratio: 16 / 9) {
	.warning {
		display: none;
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console