我正在设计网站,其中,我想在滑块上显示图片,但由于我在500中height
div
只显示图像的某些部分正在显示
即从上到下。我希望图像应该具有相同的高度,但它应该从中心显示
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="../armando-master/assets/img/Relax.jpg" alt="Los Angeles"
style="width:100%;" "height: 50%">
</div>
<div class="item">
<img src="assets/img/blog/1.jpg" alt="Chicago" style="width:100%;"
"height: 50%">
</div>
<div class="item">
<img src="assets/img/blog/3.jpg" alt="New york" style="width:100%;"
"height: 50%">`enter code here`
</div>
</div>
答案 0 :(得分:0)
<img style="width: 100%; height:100%; object-fit: cover;" />
应该做到这一点。