gpt4 book ai didi

html - 如何在 Bootstrap 轮播中调整 img 的大小?

转载 作者:行者123 更新时间:2023-11-28 04:07:59 24 4
gpt4 key购买 nike

我正在尝试构建一个集成在 WordPress 中的网站。我的问题是旋转木马的图像没有在旋转木马 div 中调整大小。我该如何解决?

HTML 来源

  <div class="item">
<img src="http://i.hizliresim.com/z34va9.jpg" alt="Chania" width="460" height="345">
</div>

<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>

CSS 源代码

.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
width: 100%;
margin: 533px;

最佳答案

object: fit; 添加到 img 对我有用。因为我希望我的旋转木马填满整个页面,所以我还使用了 height: 100vh; width: auto;,但在你的情况下它应该是 width: 100%;高度:自动;

附言我知道一年前有人问过这个问题,但其他人可能会寻找解决方案。

关于html - 如何在 Bootstrap 轮播中调整 img 的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42867120/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com