CSS Clear after every nth-child

后端 未结 7 925
执念已碎
执念已碎 2020-12-13 12:36

I have multiple items with same width inside a container. Because of different heights of the elements, there is problem with the alignment, you can see in image below.

7条回答
  •  一生所求
    2020-12-13 13:00

    You should use nth-child(3n+1) so that it happens at each child following a child multiple by 3, not only at the first 3rd child.

    Then, you should remove that :after, you want to clear the actual child.

提交回复
热议问题