line-height
プロパティを使って、行の高さを指定できます。
.sample
クラスを持つ<p>
要素を作ります。
<p class="sample"> Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda autem vero quos eveniet eum provident nulla! </p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda autem vero quos eveniet eum provident nulla!
line-height: 3rem
に設定すると行間が広がります。
<p class="sample"> Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda autem vero quos eveniet eum provident nulla! </p>
.sample { line-height: 3rem; }
3rem
Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda autem vero quos eveniet eum provident nulla!
line-height: 5rem
にすると、さらに広がります。
<p class="sample"> Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda autem vero quos eveniet eum provident nulla! </p>
.sample { line-height: 5rem; }
5rem
Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda autem vero quos eveniet eum provident nulla!
0.5rem
(小さい値)にすると狭くなり重なります。
<p class="sample"> Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda autem vero quos eveniet eum provident nulla! </p>
.sample { line-height: 0.5rem; }
Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda autem vero quos eveniet eum provident nulla!
デフォルト値はnormal
です。
<p class="sample"> Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda autem vero quos eveniet eum provident nulla! </p>
.sample { line-height: normal; }
Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda autem vero quos eveniet eum provident nulla!