对于我的生活,我无法锻炼为什么我的 4 col 布局会损坏,有人可以帮我解决吗?当您缩小浏览器时,布局更改为 3 列,我需要在所有屏幕尺寸下为 4 列。
它具有“12px”固定边距的流体宽度(“最大宽度:1056px”)。http://jsfiddle.net/KwUcG/1/
我不想使用“@media”和断点,因此我使用了最大宽度和百分比。
HTML
<section id="organisations">
<div class="wrap">
<div class="inner">
<div class="fourcol">
<div class="block">
<img src="img/fitzwilliam-museum.jpg" />
<p>Home to half a million objects of art and archaeology from pre-history to the present day.</p>
</div>
</div>
<div class="fourcol">
<div class="block">
<img src="img/fitzwilliam-museum.jpg" />
<p>Home to half a million objects of art and archaeology from pre-history to the present day.</p>
</div>
</div>
<div class="fourcol">
<div class="block">
<img src="img/fitzwilliam-museum.jpg" />
<p>Home to half a million objects of art and archaeology from pre-history to the present day.</p>
</div>
</div>
<div class="fourcol">
<div class="block">
<img src="img/fitzwilliam-museum.jpg" />
<p>Home to half a million objects of art and archaeology from pre-history to the present day.</p>
</div>
</div>
</div>
</div>
</section>
CSS
.wrap {
padding: 0 40px;
margin: 0 auto;
background: #e4f;
overflow: hidden;
}
.inner {
max-width: 1056px;
margin: 0 auto;
background: #34e;
overflow: hidden;
}
.fourcol {
display: inline-block;
width: 24%;
margin-left: 12px;
background: #ccc;
}
.fourcol:first-child { margin-left: 0; }