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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <h1>横位置の指定(align-items)</h1>
子要素を列で検証。(flex-direction: column;)<br>
<a href="https://developer.mozilla.org/ja/docs/Web/CSS/align-items" target="_blank">参考</a>
<h2>左右中央配置</h2>
<div>
  <pre><code>
    display:flex;
    align-items: center;
  </code></pre>
</div>

<div id="flex_test">
  <div class="box"><i class="fas fa-crow fa-2x"></i></div>
  <div class="box"><i class="fas fa-dog fa-2x"></i></div>
  <div class="box"><i class="fas fa-horse fa-2x"></i></div>
</div>


<h2>左寄せ</h2>
<div>
  <pre><code>
    display: flex;
    align-items: flex-start;
  </code></pre>
</div>
<div id="flex_test2">
  <div class="box-no-width" style="margin-left:4em;"><i class="fas fa-crow fa-2x"></i></div>
  <div class="box-no-width"><i class="fas fa-dog fa-2x"></i><i class="fas fa-dog fa-2x"></i><i class="fas fa-dog fa-2x"></i><i class="fas fa-dog fa-2x"></i></div>
  <div class="box-no-width" style="margin-left:6em;"><i class="fas fa-horse fa-2x"></i></div>
</div>

<h2>右寄せ</h2>
<div>
  <pre><code>
    display: flex;
    align-items: flex-end;
  </code></pre>
</div>
<div id="flex_test3">
  <div class="box-no-width"><i class="fas fa-crow fa-2x"></i></div>
  <div class="box-no-width"><i class="fas fa-dog fa-2x"></i></div>
  <div class="box-no-width"><i class="fas fa-horse fa-2x"></i></div>
</div>

<h2>横に伸ばす</h2>
(子要素のwidthが未指定じゃないと効かない)<br>
<div>
  <pre><code>
    display: flex;
    align-items: stretch;
  </code></pre>
</div>
<div id="flex_test4">
  <div class="box-no-width"><i class="fas fa-crow fa-2x"></i></div>
  <div class="box-no-width"><i class="fas fa-dog fa-2x"></i></div>
  <div class="box-no-width"><i class="fas fa-horse fa-2x"></i></div>
</div>


<h2>ベースラインを揃える</h2>
子要素のコンテンツ位置を合わせて配置してくれる?
<div>
  <pre><code>
    display: flex;
    align-items: baseline;
  </code></pre>
</div>
<div id="flex_test5">
  <div class="box-no-width"><i class="fas fa-crow fa-3x"></i></div>
  <div class="box-no-width" style="margin-left:2em;"><i class="fas fa-dog fa-5x"></i><i class="fas fa-dog fa-2x"></i><i class="fas fa-dog fa-2x"></i><i class="fas fa-dog fa-2x"></i></div>
  <div class="box-no-width" style="margin-left:5em;"><i class="fas fa-horse fa-3x"></i></div>
</div>
              
            
!

CSS

              
                #flex_test {
  display: flex;
  align-items: center;
  flex-direction: column;
  height:30em;
  background: gray;
}

#flex_test2 {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  height:30em;
  margin-top: 3em;
  background: gray;
}

#flex_test3 {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  height:30em;
  margin-top: 3em;
  background: gray;
}

#flex_test4 {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  height:30em;
  margin-top: 3em;
  background: gray;
}

#flex_test5 {
  display: flex;
  align-items: baseline;
  flex-direction: column;
  height:30em;
  margin-top: 3em;
  background: gray;
}

.box {
  height: 2em;
  width: 2em;
  background: #0a9a9a;
  margin: 1em;
  padding: 3em;
}

.box-no-width {
  background: #0a9a9a;
  margin: 1em;
  padding: 3em;
}

pre {
  margin: 1em 0;
  border-radius: 5px;
  background: #25292f;  
}
code {
  color: #fff;
  white-space: pre
}

              
            
!

JS

              
                
              
            
!
999px

Console