How to make bootstrap carousel image responsive?

前端 未结 6 1193
感情败类
感情败类 2020-12-01 10:57

I want to keep the same ratio of the images. The problem is it streches when the browser is wide. and squezes when it\'s reduced.

I have checked all SO question here

6条回答
  •  春和景丽
    2020-12-01 11:44

    I made these adjustment to bootstrap.css at lines 5835 - 5847:

    .carousel-inner {
      position: relative;
      /* Removed height here */
      overflow: hidden;
    }
    
    .carousel-item {
      position: relative;
      width: 100vh;
      height: 100vh;
      display: none;
      width: 100%;
    }
    

    Worked like a champ!

提交回复
热议问题