【问题标题】:I need to fix the carousel to a specific size and the images to fit inside the carousel我需要将旋转木马固定到特定尺寸,并将图像固定在旋转木马内
【发布时间】:2016-11-05 13:11:14
【问题描述】:

我需要将旋转木马固定为特定尺寸,并将图像固定在其中。移动视图没有问题,但在计算机上,图像会填满屏幕,然后我必须向下滚动才能看到轮播指示器。我该怎么办?

CSS 代码:

.carousel-inner > .item > img, 
.carousel-inner > .item > a > img {
    display: block;
    height: auto;
    max-width: 100%;
    line-height: 1;
    margin: auto;
    width: 100%;
}

【问题讨论】:

    标签: css image twitter-bootstrap carousel


    【解决方案1】:

    如果它不是全宽滑块,你应该把你的滑块放在 col 或容器内,请参阅下面的代码以获取参考

    如果它的全宽滑块将其放入container-fluid

    img{
      max-width: 100%;
    }
    
    <div class="container">
     <div class="row">
       <div class="col-md-12">
         ur carousel code should be here
       </div>
      </div>
    </div>
    

    如果你使用全宽容器

    <div class="container-fluid">
     <div class="row">
       <div class="col-md-12">
         ur carousel code should be here
       </div>
      </div>
    </div>
    

    【讨论】:

    • 我正在使用全宽容器。我的问题是图像的高度。
    • @Aswin 检查我的更新答案,如果你可以展示一些演示或其他东西我们可以更好地帮助你,如果你认为我的回答对你有帮助,你可以投票或/并标记为已接受
    猜你喜欢
    • 1970-01-01
    • 2022-08-03
    • 1970-01-01
    • 2014-02-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-27
    • 2012-12-24
    • 1970-01-01
    相关资源
    最近更新 更多