Button at the center and bottom of div

后端 未结 9 1379
醉酒成梦
醉酒成梦 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:02

    This is what worked for me and I think is what several people were trying to get at. Just use a full width wrapper div with the button centered inside it.

    
    
    
    .outer{
      position:relative;
      height:200px;
      width:500px;
      background-color:lightgreen;
    }
    .inner-button-container{
      background-color:grey;
      position:absolute;
      bottom:0;
      right:0;
      left:0;
      text-align:center;
    }
    
    a{
      margin:auto;
      background-color:white;
    }
    

    Result:

    Fiddle

提交回复
热议问题