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="flag">
  <div class="flag__signifier">
    <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>
  </div>
  <div class="flag__title">
    <h2>Baseline example</h2>
  </div>
  <div class="flag__content">
    <p>Sed tincidunt suscipit massa at aliquam. Duis et tincidunt orci. Curabitur scelerisque augue vel nunc fringilla pellentesque. Vestibulum ultrices bibendum magna, congue scelerisque neque porta in. Mauris auctor fringilla ex non tincidunt. Proin lobortis varius laoreet. Maecenas ut mollis velit, sed sodales eros. In feugiat mi non purus mattis vestibulum. Etiam elit risus, eleifend a semper eu, dapibus eget dui. Aliquam consectetur est diam, quis auctor dui ullamcorper eu. Sed porttitor velit sed varius placerat. Etiam non egestas dolor. Vivamus nec tellus lacus. Etiam ligula tellus, eleifend a sagittis a, blandit a dolor.</p>
  </div>
</div>

<div class="flag flag--large-icon">
  <div class="flag__signifier">
    <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="12" cy="5" rx="9" ry="3"></ellipse><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"></path><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path></svg>
  </div>
  <div class="flag__title">
    <h2>With a large signifier</h2>
  </div>
  <div class="flag__content">
    <p>Sed tincidunt suscipit massa at aliquam. Duis et tincidunt orci. Curabitur scelerisque augue vel nunc fringilla pellentesque. Vestibulum ultrices bibendum magna, congue scelerisque neque porta in. Mauris auctor fringilla ex non tincidunt. Proin lobortis varius laoreet. Maecenas ut mollis velit, sed sodales eros. In feugiat mi non purus mattis vestibulum. Etiam elit risus, eleifend a semper eu, dapibus eget dui. Aliquam consectetur est diam, quis auctor dui ullamcorper eu. Sed porttitor velit sed varius placerat. Etiam non egestas dolor. Vivamus nec tellus lacus. Etiam ligula tellus, eleifend a sagittis a, blandit a dolor.</p>
  </div>
</div>

<div class="flag flag--large-title">
  <div class="flag__signifier">
    <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"></path></svg>
  </div>
  <div class="flag__title">
    <h2>With a large title</h2>
  </div>
  <div class="flag__content">
    <p>Sed tincidunt suscipit massa at aliquam. Duis et tincidunt orci. Curabitur scelerisque augue vel nunc fringilla pellentesque. Vestibulum ultrices bibendum magna, congue scelerisque neque porta in. Mauris auctor fringilla ex non tincidunt. Proin lobortis varius laoreet. Maecenas ut mollis velit, sed sodales eros. In feugiat mi non purus mattis vestibulum. Etiam elit risus, eleifend a semper eu, dapibus eget dui. Aliquam consectetur est diam, quis auctor dui ullamcorper eu. Sed porttitor velit sed varius placerat. Etiam non egestas dolor. Vivamus nec tellus lacus. Etiam ligula tellus, eleifend a sagittis a, blandit a dolor.</p>
  </div>
</div>

<div class="flag flag--no-title">
  <div class="flag__signifier">
    <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"></path></svg>
  </div>
  <div class="flag__title"></div>
  <div class="flag__content">
    <p>No title. Sed tincidunt suscipit massa at aliquam. Duis et tincidunt orci. Curabitur scelerisque augue vel nunc fringilla pellentesque. Vestibulum ultrices bibendum magna, congue scelerisque neque porta in. Mauris auctor fringilla ex non tincidunt. Proin lobortis varius laoreet. Maecenas ut mollis velit, sed sodales eros. In feugiat mi non purus mattis vestibulum. Etiam elit risus, eleifend a semper eu, dapibus eget dui. Aliquam consectetur est diam, quis auctor dui ullamcorper eu. Sed porttitor velit sed varius placerat. Etiam non egestas dolor. Vivamus nec tellus lacus. Etiam ligula tellus, eleifend a sagittis a, blandit a dolor.</p>
  </div>
</div>

<div class="flag flag--no-title flag--large-icon">
  <div class="flag__signifier">
    <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"></path></svg>
  </div>
  <div class="flag__title"></div>
  <div class="flag__content">
    <p>No title, large icon. Sed tincidunt suscipit massa at aliquam. Duis et tincidunt orci. Curabitur scelerisque augue vel nunc fringilla pellentesque. Vestibulum ultrices bibendum magna, congue scelerisque neque porta in. Mauris auctor fringilla ex non tincidunt. Proin lobortis varius laoreet. Maecenas ut mollis velit, sed sodales eros. In feugiat mi non purus mattis vestibulum. Etiam elit risus, eleifend a semper eu, dapibus eget dui. Aliquam consectetur est diam, quis auctor dui ullamcorper eu. Sed porttitor velit sed varius placerat. Etiam non egestas dolor. Vivamus nec tellus lacus. Etiam ligula tellus, eleifend a sagittis a, blandit a dolor.</p>
  </div>
</div>
              
            
!

CSS

              
                // Boilerplate

* { box-sizing: border-box; }

body {
  padding: 2rem;
  margin: 0;
  max-width: 70rem;
  margin: 0 auto;
  font-family: sans-serif;
  background-color: #f1f3f5;
  line-height: 1.4;
}

h1, h2, h3, p { margin: 0; line-height: inherit; }

h2 { font-size: 1.125rem; }

p { margin-top: 0.2rem; }

.flag + .flag { margin-top: 3rem; }



// Flag component

.flag {
  display: grid;
  grid-column-gap: var(--flag-gap, 1em);
  grid-template-columns: auto 1fr;
  grid-template-rows: repeat(3, minmax(min-content, max-content)) 1fr;
  grid-template-areas:
    'signifier .'
    'signifier title'
    'signifier content'
    '. content';
}

.flag__title {
  grid-area: title;
  align-self: center;
  display: flex;
  align-items: center;
  
  &:empty {
    grid-column: 1;
    grid-row: 2;
  
    &:after {
      content: "x";
      visibility: hidden;
    }
    
    ~ .flag__content {
      grid-row-start: 2;
    }
  }
}

.flag__signifier {
  grid-area: signifier;
  display: flex;
  align-self: center;
}

.flag__content {
  grid-area: content;
}

// Stress tests

.flag--large-icon svg {
  width: 4rem;
  height: 4rem;
}

.flag--large-title h2 {
  font-size: 2.8rem;
}

.flag--no-title {
  font-size: 1.1rem;
  
  p {
    margin: 0;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console