【发布时间】:2016-01-05 08:37:13
【问题描述】:
我创建了一个完整的网站,但删除了所有填充物并留下了 3 列 div。我的目标是在调整图像大小时让这 3 列垂直堆叠。
附加的 css 包含在网站的其余部分中,因此我将其全部包含在内。
我尝试查找某些媒体查询,并尝试将我的头包裹在 flexbox 上。任何帮助将不胜感激。
* {
border: 1px solid red;
/*For layout purposes only*/
}
* {
max-width: 980px;
font-family: 'Lato', sans-serif;
margin-left: auto;
margin-right: auto;
padding-bottom: 0px;
}
* {
box-sizing: border-box;
}
.container {
display: flex;
flex-wrap: wrap;
overflow: hidden;
}
.row {
width: 100%;
display: flex;
}
.img {
display: block;
margin: auto;
}
.col-1 {
width: 8.33%;
}
.col-2 {
width: 16.66%;
}
.col-3 {
width: 25%;
}
.col-4 {
width: 33.33%;
}
.col-5 {
width: 41.66%;
}
.col-6 {
width: 50%;
}
.col-7 {
<header class="container">
<div class="row">
<div class="col-4">
<img class="img" src="http://placehold.it/300x300">
</div>
<div class="col-4">
<img class="img" src="http://placehold.it/300x300">
</div>
<div class="col-4">
<img class="img" src="http://placehold.it/300x300">
</div>
</div>
</header>
【问题讨论】:
-
而不是margin: 0 auto,放'float:left'。当屏幕变窄时它应该堆叠。
标签: html css flexbox responsive-design