【问题标题】:How do i get img-fluid to work in Bootstrap Carousel?我如何让 img-fluid 在 Bootstrap Carousel 中工作?
【发布时间】:2020-12-16 11:59:14
【问题描述】:

我一直在尝试通过向它们添加 img-fluid 标签来使我的轮播中的图像具有响应性,但没有任何效果。我试过使用!important。我试过使用块。我不确定是什么阻止了这种变化。有什么建议吗?

.container{
        
        font-size: 32px;
        font-family: 'Inter', sans-serif;
        position:relative;
        top: 150px;
        right:-15px;
        font-weight: 300;
        width: 1440px;
        letter-spacing: 2px;
        
      
  }
  
 
  
  .item{
      
      
        float:right;
      
     
      
  }
  


<div class="container">
 
<div class="carousel-inner">
  <div class="item active">
    <img class="image img-fluid" src="images/image-tanya.jpg" alt="Tanya" style="height:648px; width:648px;" ><div class="carousel-caption">  
  </div>
    </div>      

  <div class="item ">
    <img class="image img-fluid" src="images/image-john.jpg" alt="John" style="height:648px; width:648px;">
  </div>

【问题讨论】:

    标签: javascript html css bootstrap-4


    【解决方案1】:

    style="height:648px; width:648px;" 是罪魁祸首

    img-fluid 类定义的样式被 HTML 中 img 标记上的内联样式覆盖。内联样式始终优先于样式表中定义的样式。尝试删除那些内联样式,看看会发生什么:)

    【讨论】:

      猜你喜欢
      • 2013-09-10
      • 2021-05-15
      • 2022-01-22
      • 2021-09-27
      • 2012-03-04
      • 2019-07-20
      • 1970-01-01
      • 2014-09-17
      • 2017-11-07
      相关资源
      最近更新 更多