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>横並び プロパティ一覧</h1>


<section>
<p>インライン要素を横に並べることができる。インラインなので、横幅など指定不可。左右の余白のみ指定可</p>  
<h2>display: inline</h2>
<ul class="display_line"> 
<li><a href="#">HOME</a></li>
<li>会社概要</li>
<li>サービス</li>
<li>採用情報</li>
<li>アクセス</li>
<li>お問い合わせ</li>
  </ul>
</section>



<section>
<p>ブロック要素として扱うことができる。</p>
  <h2>display: inline-block</h2>
 
 <ul class="display_block"> 
  <li><a href="#">HOME</a></li>
<li>会社概要</li>
<li>サービス</li>
<li>アクセス</li>
<li>お問い合わせ</li>
  </ul>
</section>

<section>
    <p>親要素をdisplay: table、子要素display: table-cell とする。テーブルセル仕様になっているため融通が効きづらい。
  </p>
  <h2>display: table-cell</h2>

   <ul class="display_ta"> 
   <li><a href="#">HOME</a></li>
   <li>会社概要</li>
<li>サービス</li>
<li>採用情報</li>
<li>アクセス</li>
<li>お問い合わせ</li>
  </ul>
  </section>

<section>
<p>フレキシブルボックス</p>
  <h2>display: flex</h2>
 
 <ul class="display_flex"> 
  <li><a href="#">HOME</a></li>
<li>会社概要</li>
<li>サービス</li>
<li>アクセス</li>
<li>お問い合わせ</li>
  </ul>
</section>

<section>
  <p>浮いた状態を保つ。親要素にoverflow: hidden;の追記が必要。</p>
  <h2>float: left</h2>
<ul class="float"> 
<li><a href="#">HOME</a></li>
<li>会社概要</li>
<li>サービス</li>
<li>採用情報</li>
<li>アクセス</li>
<li>お問い合わせ</li>
</ul>
  
</section>



              
            
!

CSS

              
                
h1,h2,h3{font-weight:bold;}
h1{margin:1%;
font-size:x-large;
font-weight:bold;}

h2{margin:1em 0 0.2em;
color:#8b0000;
border-top:solid 1px #ccc;
border-bottom:solid 1px #ccc;
font-size:1.5em; 
}

section{
  font-size:0.9em;
 width:90%;
 margin:30px auto;padding:10px;
 background-color:#eee;
 line-height:1.8em;
 color:#383838;
 overflow: hidden;
border-radius:20px;
border:5px #ddd solid;
font-weight:bold;}

/*横並び一覧*/

.float li{float:left;
margin-right:0.8em;}

.display_line li{display:inline;
margin:0.2em;
}

.display_block li{
display:inline-block;
white-space:nowrap;
background-color:#333;
color:#fff;
padding:0.3em;
text-align:center;}

.display_block a{color:#aaa;}

.display_block li:hover
{background-color:red;}


/*display_table*/
.display_ta{display:table;}

ul.display_ta li{display:table-cell;
padding:0 0.4em;}

/*display_flex*/
.display_flex{
 display:flex;
  width:80%;
}

.display_flex li
{width:20%;
white-space:nowrap;}

.block
{display:block;
width:100px;
height:100px;
margin-top:20px;
background-color:#ccc;
text-align:center;}

.display_block{display:inline-block;
margin:0.2em;
}
              
            
!

JS

              
                
              
            
!
999px

Console