通过图像在包装器中自动隐藏自动高度和宽度

Hidden auto height and width automatically in wrapper by image

我想自动隐藏图片的高度 html:

<div class="category-thumbnail">
   <img class="img-responsive" src="http://www.thedeadtrees.com/wp-content/uploads/2012/10/linkin-park-environmental-efforts.jpg" alt="">
      <div class="opacity">
        <b>Jam Wanted</b>
        <p class="description">Boleh</p>
      </div>
</div>

和css:

.category-thumbnail{
border: 1px solid red;
border-bottom: 8px solid red;
height: 250px;

}

在我的本地电脑上,宽度成功但高度仍然溢出 我的完整代码在这里:https://jsfiddle.net/dedi_wibisono17/19tsojvz/

谢谢你

在类别缩略图 class 中简单使用 "overflow: hidden;" 属性。图片会自动隐藏。

只需在 .category-thumbnail 中使用 overflow:hidden; https://jsfiddle.net/nk0a1bgp/