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

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

              
                <svg display="none">
  <symbol id="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M4.5 17q-.625 0-1.062-.438Q3 16.125 3 15.5v-11q0-.625.438-1.062Q3.875 3 4.5 3H10v1.5H4.5v11h11V10H17v5.5q0 .625-.438 1.062Q16.125 17 15.5 17Zm3.562-4L7 11.938 14.438 4.5H12V3h5v5h-1.5V5.562Z"/></symbol>
</svg>

<p>通常版:</p>

<div class="grid">
  <a class="card" href="#"><span class="card__label">青い天鵞絨を張った腰掛け</span><!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>

  <a class="card" href="#"><span class="card__label">銀河ステーションと言う声がしたというの</span><!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>

  <a class="card" href="#"><span class="card__label">ごめんなさいジョバンニはまっすぐに立って</span><!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>

  <a class="card" href="#"><span class="card__label">森の中からでもかおりだしたというふうにして</span><!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>

  <a class="card" href="#"><span class="card__label">姿勢のまままた水の中へ</span><!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>

  <a class="card" href="#"><span class="card__label">やって来るのを待っていました</span><!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>
</div>

<hr>

<p>改良版:</p>

<div class="grid">
  <a class="card card--improved" href="#"><span class="card__label">青い天鵞絨を張った腰掛け</span><!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>

  <a class="card card--improved" href="#"><span class="card__label">銀河ステーションと言う声がしたというの</span><!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>

  <a class="card card--improved" href="#"><span class="card__label">ごめんなさいジョバンニはまっすぐに立って</span><!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>

  <a class="card card--improved" href="#"><span class="card__label">森の中からでもかおりだしたというふうにして</span><!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>

  <a class="card card--improved" href="#"><span class="card__label">姿勢のまままた水の中へ</span><!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>

  <a class="card card--improved" href="#"><span class="card__label">やって来るのを待っていました</span> <!--
    --><svg class="card__icon" viewBox="0 0 20 20"><use href="#icon"/></svg></a>
</div>

              
            
!

CSS

              
                body {
  margin: 1em;
  background-color: #eee;
}

hr {
  margin-top: 3em;
  margin-bottom: 3em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1em;
}

.card {
  --icon-size: 1em;
  --icon-margin: 0.25em;
  padding: 1em 1.25em;
  color: inherit;
  line-height: 1.5;
  text-decoration: none;
  background-color: white;
  border-radius: 4px;
}

.card__label {
  padding-right: var(--icon-margin);
}

.card--improved .card__label {
  padding-right: calc(var(--icon-margin) + var(--icon-size));
}

.card__icon {
  width: var(--icon-size);
  height: var(--icon-size);
  vertical-align: -0.125em;
  fill: blue;
}

.card--improved .card__icon {
  margin-left: calc(var(--icon-size) * -1);
}

              
            
!

JS

              
                
              
            
!
999px

Console