LoginSignup
0
1

More than 5 years have passed since last update.

cssで複数カラムを横幅のmarginを0で間を開ける

Posted at

この記事の内容

複数カラムで繰り返しでitemを生成する場合、marginを左右につけて間を開けると思うがそうすると全体の左右にmarginが入り、他のパーツと横幅が変わってしまう。

:nth-of-type

指定したパーツ cssを指定したいパーツ:nth-of-type(n)

で指定したパーツのなかでcssを指定したいパーツのn番目のものを指定できる。これで偶数を2n+0で指定してmargin-leftをつける。

0
1
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
1