我的 Bootstrap 4 页面中有一副纸牌。我想对齐这些按钮以获得更好的外观。我们怎样才能做到这一点?
表格似乎不起作用,因为它们是分开的。
谢谢
最佳答案
您可以使所有 card-text
元素具有相同的高度。
一种方法是通过 javascript。写一个这样的函数:
document.addEventListener("DOMContentLoaded", function(event) {
adjustCardTextHeights();
});
function adjustCardTextHeights() {
var heights = $(".card-text").map(function() {
return $(this).height();
}).get();
maxHeight = Math.max.apply(null, heights);
$(".card-text").height(maxHeight);
}
或者使用 jQuery:
$( document ).ready(function() {
adjustCardTextHeights();
});
function adjustCardTextHeights() {
var heights = $(".card-text").map(function() {
return $(this).height();
}).get();
maxHeight = Math.max.apply(null, heights);
$(".card-text").height(maxHeight);
}
关于html - Bootstrap 4 : align content inside cards deck,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34123982/