【发布时间】:2019-01-21 05:39:58
【问题描述】:
我正在显示最大值。连续 3 张图片,如果您调整浏览器窗口的大小,它们会相互堆叠。
现在例如,如果您调整窗口大小并且只显示一张图像,我如何将图像大小设置为 width:100%;?
例如,我在 https://www.slickwords.com/ 上看到过这个。
我的代码:
#wrapper {
margin: 0 auto;
width: 900px;
max-width: 100%;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
div>div>div {
display: inline-block;
}
div>div {
text-align: center;
}
<div id="wrapper">
<div style="max-width:900px;margin: 0 auto;">
<div style="width:100%;">
<div><img src="img" width="250" height="150"><br>This text goes under the Picture.</div>
<div><img src="img" width="250" height="150"><br>This text goes under the Picture.</div>
<div><img src="img" width="250" height="150"><br>This text goes under the Picture.</div>
<div><img src="img" width="250" height="150"><br>This text goes under the Picture.</div>
<div><img src="img" width="250" height="150"><br>This text goes under the Picture.</div>
<div><img src="img" width="250" height="150"><br>This text goes under the Picture.</div>
<div><img src="img" width="250" height="150"><br>This text goes under the Picture.</div>
</div>
</div>
</div>
问候
【问题讨论】:
-
了解媒体查询,谢谢。
标签: css image responsive