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

              
                mixin card(title, content)
  .box
    img(
      src="https://picsum.photos/1600/900",
      alt="",
      width="1600",
      height="900"
    )
    h1.title= title
    .content
      p= content
    .actions
      button.button Details
      button.button Buy

.grid
  +card("Short title, short text", "Lorem ipsum dolor sit amet consectetur adipisicing elit. Maiores magni reiciendis eveniet facilis consectetur nemo maxime molestiae numquam fugiat excepturi nam placeat, perspiciatis dolor, vel distinctio quis assumenda quia deleniti!")

  +card("Very extremely long title, with long text", "Shorter body copy")

  +card("Short title, short text", "lorem")

  +card("Short title, short text", "lorem")

              
            
!

CSS

              
                .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 2rem;
  padding: 2rem;
}

.box {
  overflow: hidden;

  grid-row: span 4;

  padding: 0;
  margin: 0 !important;

  @supports (grid-template-rows: subgrid) {
    display: grid;
    gap: 0; // overrides 2rem
    grid-template-rows: subgrid;
  }
  @supports not (grid-template-rows: subgrid) {
    display: flex;
    flex-direction: column;
    .content {
      flex: 1;
    }
  }

  .title {
    margin: 0;
    padding: 1rem;
    background: hsl(40, 50%, 90%);
  }
  .content {
    margin: 0;
    padding: 1rem;
    background: hsl(40, 50%, 93%);
  }
  .actions {
    padding: 1rem;
    background: hsl(40, 50%, 96%);
  }
  img {
    width: 100%;
    height: 200px;
    // aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
  }
}

body {
  background: radial-gradient(circle at bottom right, #eee, #ccc);
  margin: 0;
  min-height: 100vh;
}

              
            
!

JS

              
                
              
            
!
999px

Console