我无法缩放轮播图片,而无法在移动版本上裁剪。我尝试了与Web不同的解决方案,但是没有一个对我有用,或者我做错了什么。我只是在想什么吗,还是这里一切都不对?
这是我的轮播html代码:
<header>
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active img-responsive" href="index3.html" style="background-image: url('img/test2.jpg')" class="img-responsive img-cus">
<div class="carousel-caption d-none d-md-block" style="color:darkslategray;">
<h3>Producent kotłów 5 klasy</h3>
<p>Kocioł z podajnikiem dzięki specjalnym rozwiązaniom pozwala na uzyskanie bezdymnego spalania, niskiej emisji i sprawności co najmniej 89,9 %.</p>
</div>
</div>
<div class="carousel-item" style="background-image: url('./img/test.jpg')">
<div class="carousel-caption d-none d-md-block" style="color:white; ">
<h3 class="strokeme">Pełen profesjonalizm</h3>
<p class="strokeme">Działamy na rynku od 29 lat.</p>
</div>
</div>
<div class="carousel-item" style="background-image: url('./img/test3.jpg')"><a href="index3.html">
<div class="carousel-caption d-none d-md-block" style="color:red;">
<h3>Szeroka oferta</h3>
<p>Posiadamy kompletną ofertę kotłów według nowych norm</p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</header>
这是CSS:
.carousel-item {
height: 100vh;
min-height: 300px;
background: no-repeat center center scroll;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
margin: auto;
}
答案 0 :(得分:0)
您正在设置vh,这意味着它会自动缩放,因此图像可以真实地填充东西,但不关心侧面。尝试将图片上的vw(视图宽度)设置为100%