<h2>インライン要素</h2>
<span class="inline1">ダミーテキスト</span>
<span class="inline2">ダミーテキスト</span>
<span class="inline3">ダミーテキスト</span>

<div style="width:100%;height:3px;background:#555;margin:50px 0"></div>

<h2>インラインブロック要素</h2>
<span class="inline-block1">ダミーテキスト</span>
<span class="inline-block2">ダミーテキスト</span>
<span class="inline-block3">ダミーテキスト</span>
* {
  margin: 0;   /* 初期化 */
  padding: 0;  /* 初期化 */
}

.inline1 {
  background-color: red;
  margin: 20px;
  padding: 10px;
  width: 70px;
  height: 70px;
}
.inline2 {
  background-color: gray;
  margin: 20px;
  padding: 10px;
  width: 70px;
  height: 70px;
}
.inline3 {
  background-color: blue;
  margin: 20px;
  padding: 10px;
  width: 70px;
  height: 70px;
}

.inline-block1 {
  background-color: red;
  display: inline-block;
  margin: 20px;
  padding: 10px;
  width: 70px;
  height: 70px;
}
.inline-block2 {
  background-color: gray;
  display: inline-block;
  margin: 20px;
  padding: 10px;
  width: 70px;
  height: 70px;
}
.inline-block3 {
  background-color: blue;
  display: inline-block;
  margin: 20px;
  padding: 10px;
  width: 70px;
  height: 70px;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.