LoginSignup
0
0

More than 3 years have passed since last update.

HTML の ブロック要素 を 横方向の中央に配置する設定 ~CSS margin: 0 auto;~

Last updated at Posted at 2019-07-13

目的

  • HTMLファイルのブロック要素を左右の幅を均等に配置する設定方法をまとめる。

押さえるポイント

  • marginプロパティの余白指定を応用する。
  • 画面上下の幅を均等に設定することは出来ない。
  • marginプロパティにて横方向の余白をautoとして指定する。

書き方の例

  • 下記にCSSファイルの内容を記載する。
要素の名前かクラス名 {
  margin: 0 auto;
}

※具体的な例が思い浮かばなかったため今回は記載しない。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0