Bootstrap carousel width and height

前端 未结 8 1508
不思量自难忘°
不思量自难忘° 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

    Are you trying to make it responsive? If you are then I would just recommend the following:

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

    However, the best way to handle this responsively would be thru the use of media queries like such:

    /* Smaller than standard 960 (devices and browsers) */
    @media only screen and (max-width: 959px) {}
    
    /* Tablet Portrait size to standard 960 (devices and browsers) */
    @media only screen and (min-width: 768px) and (max-width: 959px) {}
    
    /* All Mobile Sizes (devices and browser) */
    @media only screen and (max-width: 767px) {}
    
    /* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
    @media only screen and (min-width: 480px) and (max-width: 767px) {}
    
    /* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
    @media only screen and (max-width: 479px) {}
    

提交回复
热议问题