【问题标题】:Bootstrap: How to fix panel height and make an image inside of the panel follow that fixed height?Bootstrap:如何固定面板高度并使面板内的图像遵循该固定高度?
【发布时间】:2018-07-30 05:40:24
【问题描述】:

我将图像放在引导程序的面板中,但无论我做什么,面板的高度总是会调整为图像的高度。如何制作固定的面板高度以及如何使图像的高度调整到面板的固定高度?

【问题讨论】:

    标签: php jquery html css


    【解决方案1】:

    如果您的面板已经有固定高度并且您的图像在面板 div 内,只需添加以下样式:

    height: 100%;
    

    你的形象。

    例子:

    <div class="test">
    <img src="test.jpg">
    </div>
    

    还有你的 CSS:

    .test {
      background-color: red;
      height: 50px;
    }
    
    .test img {
      height:100%;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-18
      • 1970-01-01
      • 1970-01-01
      • 2014-04-14
      • 2017-10-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多