Aligning grid items across the entire row/column (like flex items can)

前端 未结 2 1456
礼貌的吻别
礼貌的吻别 2020-11-22 06:41

With a flex container and flex-wrap: wrap set you can align overflowing items to the center using justify-content: center.

Is there a way

2条回答
  •  天命终不由人
    2020-11-22 07:07

    Not the way you want with flex. You have to be precise with CSS-Grid,

    Grid

    item
    item
    item
    item
    item
    item
    item
    .container-grid { display: grid; grid-template-columns: repeat(3, 1fr); } .item { background: red; border: 1px solid; } .item-mid{ background:purple; grid-column:2/1; }

    Also, look here,

    Centering in CSS Grid

    (this is not wrapping, however)

提交回复
热议问题