LoginSignup
1

More than 5 years have passed since last update.

cssセンター寄せとfloatに関して

Posted at

cssにてセンター寄せを行うには

margin: 0 auto;

と表記するだけ

floatに関してはhtmlの平面上から浮き上がっているので、
次に配置されている要素が下に潜り込んでしまうのです。

それを解除してくれるのが、clearプロパティです。

clear:both;

floatを指定した要素の次の要素にclearプロパティを指定することが大切!!

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
1