Align two buttons at the bottom

2019-09-11 05:39发布

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.

enter image description here

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.

2条回答
戒情不戒烟
2楼-- · 2019-09-11 06:11

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

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

.card-block {
  height: 250px;
}
查看更多
来,给爷笑一个
3楼-- · 2019-09-11 06:31

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%);
}
查看更多
登录 后发表回答