Button at the center and bottom of div

后端 未结 9 1234
醉酒成梦
醉酒成梦 2021-02-06 11:35

How to make a button be at the bottom of div and at the center of it at the same time?

9条回答
  •  死守一世寂寞
    2021-02-06 12:03

    You can use align-items: flex-end like so:

    html,
    body {
      height: 100%;
    }
    
    .flex-container {
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .center {
      width: 200px;
      height: 200px;
      background: #0088cc;
      display: flex;
      align-items: flex-end;
    }
    
    .btn-bot {
      margin: 0 auto;
      display: block;
    }

提交回复
热议问题