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

              
                <h1>Hello World</h1>
<ul>
  <li>This text color is red between medium (960px) and small screen (768px)</li>
  <li>Become green when below extra small screen (480x)</li>
  <li>And have larger font size when below 300px</li>
</ul>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quaerat mollitia laudantium minima reprehenderit</p>
<p>Laboriosam nulla inventore amet ratione deserunt delectus excepturi beatae omnis modi repudiandae molestias quo debitis quia ullam</p>
<p>Voluptas sit ab? In labore cumque accusantium, officiis eius iure quisquam eligendi dicta voluptatum adipisci perspiciatis repellat ipsam?</p>
<p>Eos dolore ex dolor exercitationem iusto, doloribus alias odit. Deserunt fugiat inventore quidem architecto repudiandae. Error harum in beatae nihil quasi, vel dolore odio blanditiis, doloribus ad adipisci.</p>
<p>Totam aspernatur accusamus. Quas sunt voluptatibus, tenetur aliquid quos quibusdam placeat laboriosam est earum! Quaerat laborum consectetur minus mollitia exercitationem velit tempora voluptatum quos!</p>
              
            
!

CSS

              
                // Extra Small (mobile)
$below-xs: "max-width:480px";
$above-xs: "min-width:481px";

// Small (tablet)
$below-s: "max-width:768px";
$above-s: "min-width:769px";

// Medium (landscape tablet)
$below-m: "max-width:960px";
$above-m: "min-width:961px";

// Large (content max-width)
$below-l: "max-width:1120px";
$above-l: "min-width:1121px";

$portrait: "orientation: portrait";
$landscape: "orientation: landscape";
$retina: "min-resolution: 192dpi";


@function below( $size-px ) {
  @return "max-width: #{$size-px}";
}

@function above( $size-px ) {
  @return "min-width: #{$size-px}";
}

// -------

body {
  color: black;
  
  @media ($above-s) and ($below-m) {
    color: red;
  }

  @media ($below-xs) {
    color: green;
  }
    
  @media (below(300px)) {
    font-size: 20px;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console