Align two buttons at the bottom

一世执手 提交于 2020-01-17 06:37:12

问题


I am using Bootstrap 4's card groups. I want to align both buttons at the same line which should be at bottom of the .card.

The jsfiddle.

I tried

.card {
  position: relative;
}

.btn {
  position: relative;    // <- if I use absolute here, it will be ugly
  bottom: 0;
}

and also

.card {
  display: table;
}

.btn {
  display: table-cell;
  vertical-align: bottom;
}

But neither works.


回答1:


would something like this work for you ?

https://jsfiddle.net/44Lnjj8d/5/

.card {
  position: relative;
  padding-bottom: 40px;
}

.btn {
  position: absolute;
  bottom: 10px;
  left: 50%;
  -ms-transform:: translateX(-50%);
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
}



回答2:


You can set the card-block height and the buttons will show after the block.

https://jsfiddle.net/44Lnjj8d/6/

.card-block {
  height: 250px;
}


来源:https://stackoverflow.com/questions/38949076/align-two-buttons-at-the-bottom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!