【发布时间】:2014-10-02 20:32:25
【问题描述】:
我正在尝试在页面的顶部、底部、左侧和右侧创建一个带有 20 像素间距的页面。我的容器的当前设置似乎不适用于我想在容器的骑行侧设置的 20 像素排水沟
这是我的 HTML:
<body>
<div class="neo_wrapper"> <!-- Wrapper start -->
<div class="neo_container"> <!-- Container start -->
<div class="neo_header-fixed"></div>
<div class="neo_column_a"></div>
<div class="neo_column_b"></div>
<div class="neo_column_c"></div>
<div class="neo_footer-fixed"></div>
</div> <!-- Container end -->
</div> <!-- Wrapper end -->
</body>
还有我的 CSS
*{
margin: 0;
padding: 0;
border: none;
}
/* Wrapper for entire page */
.neo_wrapper{
width: 100%;
height: 900px;
margin: 0 auto;
}
/* Container for content */
.neo_container{
width: 100%;
height: 100%;
margin: 120px -20px 50px 20px;
}
/* Fixed header */
.neo_header-fixed{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100px;
background: #999;
z-index: 1000;
}
.neo_column_a{
width: 33.3333333333%;
height: 100%;
background: #063;
float: left;
}
.neo_column_b{
width: 33.3333333333%;
height: 100%;
background: #00F;
float: left;
}
.neo_column_c{
width: 33.3333333333%;
height: 100%;
background: #F00;
float: left;
}
/* Fixed footer */
.neo_footer-fixed{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 30px;
background: #999;
z-index: 1000;
}
还有 jsFiddle:http://jsfiddle.net/x0cfdm5r/
【问题讨论】:
-
我猜 gutter 是 padding 或 margin :)
-
考虑以不同的方式排列您的标记。将您的固定页眉和页脚放在包装器之外。这样你就可以在包装器内只包含三个内容列,将边距(不是装订线)应用于包装器,然后瞧。
标签: html css containers margin