我正在为一个客户做一个网站,它使用myCarousel在主页和全视图上,幻灯片图像是很好的,但在移动视图上,图像是垂直拉伸由于有高度: 180px;幻灯片图像有3-5行的标题,所以放在固定的高度,但客户说他们是拉伸的,所以我把对象适合:封面在哪种解决了拉伸的问题,但它切断了两侧的图像和客户端不满意这一点,我尝试了img响应,再次解决了拉伸的问题,但标题然后不适合。我不知道该怎么做,我想没有办法了,有没有人能帮上忙?

发布于 2019-04-17 21:10:40
更新:我想我已经用下面的CSS解决了这个问题
.carousel-inner > .item > img {
height: 180px;
object-fit: cover;
width: 100%;
object-position: right center;
}
.carousel-inner > .item:nth-of-type(7) > img {
height: 180px;
object-fit: cover;
width: 100%;
object-position: left center;
}
.carousel-inner > .item:nth-of-type(9) > img {
height: 180px;
object-fit: cover;
width: 100%;
object-position: left center;
}
.carousel-inner > .item:nth-of-type(10) > img {
height: 180px;
object-fit: cover;
width: 100%;
object-position: left center;
}
.carousel-inner > .item:nth-of-type(12) > img {
height: 180px;
object-fit: cover;
width: 100%;
object-position: left center;
}它似乎已经与CSS一起工作了
https://stackoverflow.com/questions/55716405
复制相似问题