Bootstrap 4 carousel not responsive images

旧时模样 提交于 2019-11-27 02:22:25

问题


Look at this: http://www.consultacultura.it/portale_comunale_della_cultura.asp?IDcomune=1

Carousel images are not responsive like images under of it. They have the same class img-fluid.


回答1:


This is a known issue in Bootstrap 4 Alpha 6...

https://github.com/twbs/bootstrap/issues/21611

As a workaround you can use..

.carousel-item.active,
.carousel-item-next,
.carousel-item-prev {
  display: block;
}

http://www.codeply.com/go/0QUU06MiIL




回答2:


For me that workaround did not work for both, desktops and mobiles. I adjusted the proposed workaround a bit to make it -orientation- sensible.

@media (orientation: portrait) { 
    .carousel-item.active,
    .carousel-item-next,
    .carousel-item-prev {
        display: block;
        width:100%;
        height:auto;
    }
}

@media (orientation: landscape) { 
    .carousel-item.active,
    .carousel-item-next,
    .carousel-item-prev {
        display: block;
        width:100%;
        height:96vh;
    }
}


来源:https://stackoverflow.com/questions/41679456/bootstrap-4-carousel-not-responsive-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!