Center and bottom-align flex items

后端 未结 3 1743
悲&欢浪女
悲&欢浪女 2020-11-22 00:35

I have a flex container (the blue square) with the following properties:

display: flex;
justify-content: center;
align-items: center;
flex-wrap: nowrap;
         


        
3条回答
  •  灰色年华
    2020-11-22 00:58

    you can use a pseudo to move down one row the first three containers then applie a margin:auto to last one

    div {
      display:flex;
      flex-wrap:wrap;
      border:#0066FD solid;;
      width:200px;
      height:200px;
      justify-content:space-around;
      /* show me box center */
      background:linear-gradient(to top,rgba(0,0,0,0.2) 50%, transparent 50%),linear-gradient(to left,rgba(0,0,0,0.2) 50%, transparent 50%)
     
    }
    
    span, div:before {
      width:50px;
      height:50px;
      border:solid #01CDFF;
      margin:0 auto 0;
    }
    span:last-of-type , div:before{
      margin: 12px auto;
      border:solid  #01FE43;
    }
    div:before {
      content:'';
      width:100%;
      border:none;
    }
    
    span {
       /* show me box center */
      background:linear-gradient(45deg,rgba(0,0,0,0.1) 50%, transparent 50%),linear-gradient(-45deg,rgba(0,0,0,0.1) 50%, transparent 50%)
      }

提交回复
热议问题