2016-08-15 132 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%); 
}