在猫头鹰旋转木马、画布中垂直居中项目



我试图(1(让图像转盘垂直居中图像,(2(让转盘缩小到最小图像的高度[即不浪费空白]。这有点像";多重图像";旋转木马,像这个:https://bbbootstrap.com/snippets/clients-brand-logo-carousel-slider-20683486.

我不知道在哪里添加什么类。显然,查看了d-flex+justify-items+align-items,以及其他一些SO帖子,建议我将oc-item和相关类更改为height: 100%; position: relative;,但这些似乎都没有达到预期效果。

考虑到命名,我认为这是猫头鹰转盘的一个实现(https://owlcarousel2.github.io/OwlCarousel2/)。

HTML,其中包括许多通过JS添加的元素(不是我的JS,我使用的是从Themeforest购买的一个名为Canvas的包https://themes.semicolonweb.com/html/canvas/blocks.html...我想是这一页底部的那个https://themes.semicolonweb.com/html/canvas/slider-owl.html这个页面的CSS和JS应该与我使用的相同(:

<section id="content">
<div class="content-wrap p-0" id="content-wrap-logos">
<div class="container">
<div class="fancy-title title-center title-border m-4">
<h4><small>AS SEEN WITH</small></h4>
</div>
<div id="oc-images" class="owl-carousel image-carousel carousel-widget align-middle align-items-center owl-loaded owl-drag with-carousel-dots" data-items-xs="2" data-items-sm="3" data-items-lg="4" data-items-xl="5">
<div class="owl-stage-outer"><div class="owl-stage" style="transform: translate3d(0px, 0px, 0px); transition: all 0s ease 0s; width: 2369px;">
<div class="owl-item active" style="width: 243.2px; margin-right: 20px;">
<div class="oc-item">
<a href="..." target="_blank"><img src="..." alt="..."></a>
</div>
</div>
<div class="owl-item active" style="width: 243.2px; margin-right: 20px;">
<div class="oc-item">
<a href="..." target="_blank"><img src="i..." alt="..."></a>
</div>
</div>
... etc ...
</div>
</div>
<div class="owl-nav">
<button type="button" role="presentation" class="owl-prev disabled">
<i class="icon-angle-left"></i>
</button>
<button type="button" role="presentation" class="owl-next">
<i class="icon-angle-right"></i>
</button>
</div>
<div class="owl-dots">
<button role="button" class="owl-dot active"><span></span></button>
<button role="button" class="owl-dot"><span></span></button></div></div>
</div>
</div>
</div>
</section>

您没有共享css代码,但这里是解决方案。

给出锚显示块,最小高度和垂直居中对齐。所以图像垂直居中。

.owl-item a {
display: block;
vertical-align: middle;
min-height: 38px;
}

最新更新