LAYOUT / 068
Spacing scale
余白の尺度
一定の尺度で余白を決め、まとまりと間隔を整えます。
実際のHTML・CSSで描かれた見本です。
ひとつ試すなら
余白がつくるまとまりを見る
こんなときに
画面全体の間隔をそろえたいとき。
仕組みと使い方
数値を共通化しても、内容の関係に応じて大小を使い分けます。
対応状況は使用する機能と端末により異なります。公式資料も参照してください。
表現名には通称や説明のための名称を含みます。デモと掲載コードはこの図鑑のオリジナルです。作者について
実装コードを見る
<style>
.sample{width:100%;height:100%;min-height:190px;display:grid;place-items:center;position:relative;overflow:hidden;box-sizing:border-box;font-family:Arial,'Hiragino Kaku Gothic ProN',Meiryo,sans-serif;color:#20211d;background:#f1f0e9;padding:22px}.sample *{box-sizing:border-box}.sample button,.sample input,.sample summary{font:inherit}.sample button,.sample summary,.sample label{touch-action:manipulation}.sample :focus-visible{outline:3px solid #6050bf;outline-offset:5px}.sample small{font-size:10px;line-height:1.5}.sample .editable{margin:0}.sample svg{max-width:100%;height:auto}
.sample .spacing{width:210px;display:grid;gap:12px}.sample .spacing div{display:flex;align-items:center;gap:12px}.sample b{width:22px;font:11px monospace}.sample i{height:16px;background:#222;width:32px}.sample div:nth-child(2)>i{width:64px}.sample div:nth-child(3)>i{width:96px}.sample div:nth-child(4)>i{width:128px}
</style>
<div class="sample">
<div class="spacing"><div><b>8</b><i></i></div><div><b>16</b><i></i></div><div><b>24</b><i></i></div><div><b>32</b><i></i></div></div>
</div>