How to get tiles centered and left-justified at the same time

前端 未结 9 1943
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-30 10:33

I have a container of tiles (or divs) and I want the container to be centered, while the tiles are left justified in the container.

so if the window is small:

<
9条回答
  •  天涯浪人
    2020-11-30 11:20

    Try this:

    .tiles: { 
      display: inline-block;
      margin: 0 auto;
      max-width: 90%;
    }
    

    No verticall margin, auto margin for horizontal sides!

提交回复
热议问题