Twitter Bootstrap carousel different height images cause bouncing arrows

后端 未结 14 1005
刺人心
刺人心 2020-12-07 16:11

I\'ve been using Bootstrap\'s carousel class and it has been straightforward so far, however one problem I\'ve had is that images of different heights cause the arrows to bo

14条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-07 16:51

    More recently I am testing this CSS source for the Bootstrap carousel

    The height set to 380 should be set equal to the biggest/tallest image being displayed...

    Please Vote up/down this answer based on usability testing with the following CSS thanks.

    /* CUSTOMIZE THE CAROUSEL
    -------------------------------------------------- */
    
    /* Carousel base class */
    .carousel {
      max-height: 100%;
      max-height: 380px;
      margin-bottom: 60px;
      height:auto;
    }
    /* Since positioning the image, we need to help out the caption */
    .carousel-caption {
      z-index: 10;
        background: rgba(0, 0, 0, 0.45);
    }
    
    /* Declare heights because of positioning of img element */
    .carousel .item {
      max-height: 100%;
      max-height: 380px;
      background-color: #777;
    }
    .carousel-inner > .item > img {
     /*  position: absolute;*/
      top: 0;
      left: 0;
      min-width: 40%;
      max-width: 100%;
      max-height: 380px;
      width: auto;
      margin-right:auto;
      margin-left:auto;
      height:auto;
    
    }
    

提交回复
热议问题