gpt4 book ai didi

css - img 响应不起作用

转载 作者:行者123 更新时间:2023-11-28 08:01:35 24 4
gpt4 key购买 nike

我在最新版本中使用 bootstrap 3 - 3.3.4 - 不幸的是 .img-responsive 类无法正常工作。我什么都试过了,甚至 .col-md-12.img-responsive 都试过了,什么都没有。

HTML:

<header class="container" id="container">
<div class="row">
<section class="col-md-3">
<a href="#">
<img class="img-responsive" src="http://placehold.it/350x150" alt="..." />
</a>
</section>
<section class="col-md-9">
<p>something else...</p>
</section>
</div>
</header>

CSS:

#container {
height: 60px;
background-color: red;
}

可以看到实时预览here .

@编辑

图像在容器上方 - 红色部分 - 这就是问题的原因,.img-responsive 应该调整图像大小以使其适合,但它没有。

最佳答案

删除height: 60px;

你只需要:

#container {    
background-color: red;
}

图片的高度为 150 像素,但#container 的高度为 60 像素。

关于css - img 响应不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29724992/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com