2016-08-15 134 views
0

我正在使用Bootstrap 4的card groups。我想将两个按钮对齐在.card的底部。在底部对齐两个按钮

enter image description here

jsfiddle

我试图

.card { 
    position: relative; 
} 

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

.card { 
    display: table; 
} 

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

但无论是作品。

+0

为什么你认为绝对定位将是难看..? –

+0

@Nareshsadu因为我试了一下,当使用'绝对'时,所有东西都不会再组织起来 –

回答

1

会是这样的工作吗?

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%); 
}