LoginSignup
25
17

More than 5 years have passed since last update.

【CSS】要素を横に並べる

Posted at

liやdivを横に並べる方法。

対象のhtml
<div class='box'>box</div>
<div class='box'>box</div>
<div class='box'>box</div>

<div class='after'>after</div>

floatを使う方法

floatして、clearで回り込みを消す。

css
.box{
 float: left;
 width: 200px;
}
.after{
 clear:both;
}

inline-blockを使う方法

css
.box{
 display: inline-block;
 width: 200px;
}

参考:inline-blockで作るレイアウト

25
17
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
25
17