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>The nested CSS here will not work until your browser supports it.</h1>
<p><a href="https://caniuse.com/css-nesting"><img src="https://caniuse.bitsofco.de/image/css-nesting.png" loading="lazy" decoding="async" alt="Can I use live updating chart of browser support. Use the link to get the accessibility friendly version."></a></p>
<article>
  <h2>HubSpot CMS Hub®</h2>
  <p>Content management software that's flexible for marketers, powerful for developers, and gives your customers a personalized, secure experience.</p>
  <p class="second-paragraph">Includes hosting, flexible themes, dynamic content, drag-and-drop page editing, memberships, and more — all powered by a CRM platform that allows you to build seamless digital experiences for your customers.</p>
  <a href="https://www.hubspot.com/products/cms">Learn more about CMS Hub</a>

</article>

<article class="featured">
  <h2>HubSpot CMS Hub®</h2>
  <p>Content management software that's flexible for marketers, powerful for developers, and gives your customers a personalized, secure experience.</p>
  <a href="https://www.hubspot.com/products/cms">Learn more about CMS Hub</a>
</article>
              
            
!

CSS

              
                /*
  CSS Nesting will work very similar to SCSS but with 1 very important difference. 
*/

/* The code below will work. */
article {
  .second-paragraph {
    color: red;
  }
}
/* The code below won't work.*/
article {
  p {
    color: blue;
  }
}
/*
  For technical reasons element selectors can't be the item in a child selector. I don't know all the reasons but likely it has to do with CSS properties beig written similarly, and generating the CSSOM. Backward compatibility of CSS, etc.

The solution - honestly is very easy and will make sense if you've used SCSS.
*/

article {
  & p {
    color: rebeccapurple;
  }
}

/* That also let's you do intersting things like this */

article {
  &.featured{
    /* which means article.featured */
    border-color:red;
  }
  & p {
    color: rebeccapurple;
  }
}

/* The styles below are just for presentation and are not related to the CSS Nesting */
article {
  border: 1px solid #000;
  margin-block: 1em;
  padding: 1em;
}

              
            
!

JS

              
                
              
            
!
999px

Console