【发布时间】:2019-04-01 15:05:57
【问题描述】:
我有以下结构:
<div class="carousel" id="my-carousel">
<div class="carousel-item">
<div class="text-center">
...
</div>
</div>
<div class="carousel-item">
<div class="text-center">
...
</div>
</div>
<div class="carousel-item">
<div class="text-center">
...
</div>
</div>
</div>
我还有以下用于标准化轮播的脚本:
function normalizeCarousel() {
function normalize() {
var maxHeight = 0;
$(".carousel-item").each(function() {
var currentHeight = $(this).height();
if (currentHeight > maxHeight) {
maxHeight = currentHeight;
}
});
$("#my-carousel").css("height", maxHeight);
};
normalize();
$(window).on("resize orientationchange", function() {
normalize();
});
}
$(document).ready(function() {
normalizeCarousel();
});
这里是 JSFiddle:JSFiddle
我要做的是垂直对齐carousel-items 内的每个text-center div。我尝试过使用flexbox,但无法成功!
提前谢谢你!
【问题讨论】:
标签: html css twitter-bootstrap vertical-alignment