Bootstrap carousel width and height

前端 未结 8 1510
不思量自难忘°
不思量自难忘° 2020-12-12 20:55

Im trying to do a bootstrap carousel with full width for the images (width: 100%) and a fixed height but if I set the width to 100% the height automacally is taking the 100%

相关标签:
8条回答
  • 2020-12-12 21:26

    I found that if you just want to change the height of the element the image takes up, this will be the code that will help

    .carousel-item { height: 600px !important; }

    however, this won't make the size of the image dynamic, it will simply crop the image to its size.

    0 讨论(0)
  • 2020-12-12 21:26

    just put height="400px" into image attribute like

    <img class="d-block w-100" src="../assets/img/natural-backdrop.jpg" height="400px" alt="First slide">
    
    0 讨论(0)
提交回复
热议问题