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

              
                <div class="container">
  <h2>The Baseline</h2>
  <section class="default">
      <h3>Inline-block (broken)</h3>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dignissim nec nulla gravida lacinia. Donec <a href="#">pharetra</a> mi vitae arcu tempus, vitae semper mi iaculis. Class aptent taciti sociosqu ad <a href="#">litora</a> torquent per conubia nostra, per <a href="#">inceptos</a> himenaeos. Sed id aliquam tellus. Quisque convallis in enim eu bibendum. Nullam quis sapien <a href="#">interdum erat vestibulum bibendum finibus</a> ac quam. Mauris vestibulum urna metus, nec luctus massa volutpat non. Maecenas nibh purus, laoreet in risus vitae, scelerisque congue mauris. Pellentesque vulputate lobortis euismod.</p>
  </section>
  <h2>The Solutions</h2>
    <section class="no-wrap">
      <h3>Cheating with the markup</h3>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dignissim nec nulla gravida lacinia. Donec <a href="#"><span>pharetra</span></a> mi vitae arcu tempus, vitae semper mi iaculis. Class aptent taciti sociosqu ad <a href="#"><span>litora</span></a> torquent per conubia nostra, per <a href="#"><span>inceptos</span></a> himenaeos. Sed id aliquam tellus. Quisque convallis in enim eu bibendum. Nullam quis sapien <a href="#">interdum erat vestibulum bibendum <span>finibus</span></a> ac quam. Mauris vestibulum urna metus, nec luctus massa volutpat non. Maecenas nibh purus, laoreet in risus vitae, scelerisque congue mauris. Pellentesque vulputate lobortis euismod.</p>
  </section>
  <section class="padding-margin">
      <h3>Inline-block with padding/margin</h3>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dignissim nec nulla gravida lacinia. Donec <a href="#">pharetra</a> mi vitae arcu tempus, vitae semper mi iaculis. Class aptent taciti sociosqu ad <a href="#">litora</a> torquent per conubia nostra, per <a href="#">inceptos</a> himenaeos. Sed id aliquam tellus. Quisque convallis in enim eu bibendum. Nullam quis sapien <a href="#">interdum erat vestibulum bibendum finibus</a> ac quam. Mauris vestibulum urna metus, nec luctus massa volutpat non. Maecenas nibh purus, laoreet in risus vitae, scelerisque congue mauris. Pellentesque vulputate lobortis euismod.</p>
  </section>
  <section class="inline-only">
      <h3>Inline only</h3>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dignissim nec nulla gravida lacinia. Donec <a href="#">pharetra</a> mi vitae arcu tempus, vitae semper mi iaculis. Class aptent taciti sociosqu ad <a href="#">litora</a> torquent per conubia nostra, per <a href="#">inceptos</a> himenaeos. Sed id aliquam tellus. Quisque convallis in enim eu bibendum. Nullam quis sapien <a href="#">interdum erat vestibulum bibendum finibus</a> ac quam. Mauris vestibulum urna metus, nec luctus massa volutpat non. Maecenas nibh purus, laoreet in risus vitae, scelerisque congue mauris. Pellentesque vulputate lobortis euismod.</p>
  </section>
</div>
              
            
!

CSS

              
                .container {
  max-width: 28em;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.4;
  font-family: sans-serif;
}

@mixin afterIcon {
  content: '';
  background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImJsdWUiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0iZmVhdGhlciBmZWF0aGVyLWV4dGVybmFsLWxpbmsiPjxwYXRoIGQ9Ik0xOCAxM3Y2YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0yVjhhMiAyIDAgMCAxIDItMmg2Ij48L3BhdGg+PHBvbHlsaW5lIHBvaW50cz0iMTUgMyAyMSAzIDIxIDkiPjwvcG9seWxpbmU+PGxpbmUgeDE9IjEwIiB5MT0iMTQiIHgyPSIyMSIgeTI9IjMiPjwvbGluZT48L3N2Zz4=);
}

.default {
  --icon-width: 0.8em;
  
  a {
    &:after {
      @include afterIcon;
      display: inline-block;
      vertical-align: middle;
      width: var(--icon-width);
      height: var(--icon-width);
      margin-top: -0.2em;
      margin-left: 0.2em;
      background-size: cover;
    }
  }
}

.no-wrap {
  --icon-width: 0.8em;
  
  a > span {
    white-space: nowrap;

    &:after {
      @include afterIcon;
      display: inline-block;
      vertical-align: middle;
      width: var(--icon-width);
      height: var(--icon-width);
      margin-top: -0.2em;
      margin-left: 0.2em;
      background-size: cover;
    }
  }
}

.padding-margin {
  --icon-width: 0.8em;
  
  a {
    padding-right: var(--icon-width);
    
    &,
    &:after {
      display: inline-block;
    }
    
    &:after {
      @include afterIcon;
      vertical-align: middle;
      width: var(--icon-width);
      height: var(--icon-width);
      margin-top: -0.2em;
      margin-left: 0.2em;
      margin-right: calc(var(--icon-width) * -1);
      background-size: cover;
    }
  }
}

.inline-only {
  --icon-width: 0.8em;
  
  a {
    &:after {
      @include afterIcon;
      margin-left: 0.2em;
      padding-left: var(--icon-width);
      background-size: var(--icon-width) var(--icon-width);
      background-position: center center;
      background-repeat: no-repeat;
    }
  }
}


              
            
!

JS

              
                
              
            
!
999px

Console