更改轮播滑块自举高度

时间:2017-07-29 07:52:53

标签: html css

我需要更改旋转木马滑块bootstarp的高度,我已经厌倦了在像素中为图像设置一个固定的高度,但它不起作用,我已经厌倦了将固定的高度也设置为ID bs-旋转木马,但它不起作用,项目滑动。

.btn.btn-lg {
  padding: 10px 40px;
}

.btn.btn-hero,
.btn.btn-hero:hover,
.btn.btn-hero:focus {
  color: #f5f5f5;
  background-color: #46c3ff;
  border-color: #46c3ff;
  outline: none;
  margin: 20px auto;
}

.fade-carousel .slides .slide-1,
.fade-carousel .slides .slide-2,
.fade-carousel .slides .slide-3 {
  height: 100vh;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.fade-carousel .slides .slide-1 {
  background-image: url(http://evisax.com/img/dubai.png);
}

.fade-carousel .slides .slide-2 {
  background-image: url(http://evisax.com/img/free_singapore_tour_900.jpg);
}

.fade-carousel .slides .slide-3 {
  background-image: url(http://evisax.com/img/Taj_Mahal.png);
}

@media screen and (min-width: 980px) {
  .hero {
    width: 980px;
  }
}

@media screen and (max-width: 640px) {
  .hero h1 {
    font-size: 4em;
  }
}
<div class="carousel fade-carousel slide" data-ride="carousel" data-interval="4000" id="bs-carousel">
  <!-- Overlay -->
  <div class="overlay"></div>
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#bs-carousel" data-slide-to="0" class="active"></li>
    <li data-target="#bs-carousel" data-slide-to="1"></li>
    <li data-target="#bs-carousel" data-slide-to="2"></li>
  </ol>
  <!-- Wrapper for slides -->
  <div class="carousel-inner">
    <div class="item slides active">
      <div class="slide-1"></div>
      <div class="hero">
      </div>
    </div>
    <div class="item slides">
      <div class="slide-2"></div>
      <div class="hero">
      </div>
    </div>
    <div class="item slides">
      <div class="slide-3"></div>
      <div class="hero">
      </div>
    </div>
  </div>
</div>

2 个答案:

答案 0 :(得分:0)

使用!important更改身高

.carousel-inner{
  width:100%;
  max-height: 200px !important;
}

答案 1 :(得分:0)

尝试此操作,使用 px 代替 Vh 进行以下

.fade-carousel .slides .slide-1, 
.fade-carousel .slides .slide-2,
.fade-carousel .slides .slide-3 {
  height: 100px; 
}

FIDDLE-DEMO