ブロック要素を左右の中央に配置 - CSS
中央に配置する
width
を指定margin
の左右をauto
に設定
.main { /* 横幅を指定 */ width: 100px; /* 中央に配置 */ margin: 0 auto; }
See the Pen wmEavW by tamago (@tamago324) on CodePen.
中央に配置する
width
を指定margin
の左右をauto
に設定.main { /* 横幅を指定 */ width: 100px; /* 中央に配置 */ margin: 0 auto; }
See the Pen wmEavW by tamago (@tamago324) on CodePen.