【发布时间】:2014-08-17 05:47:14
【问题描述】:
我在使用 Susy 响应式网格时遇到了一些问题。我正在尝试设置两行三列布局。这是我正在使用的代码。
$susy: (
columns: 12,
gutters: 1/2,
math: fluid,
output: float,
gutter-position: inside,
);
$desktop:960px;
@include breakpoint($desktop){
body{
@include container(95%);
background: $faintgray;
}
.container {
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
h2 {
margin: 0 auto 13px auto
}
section {
@include span(4);
text-align: center;
}
section:not(:first-of-type) {
border-left: 1px dashed $lightgray;
}
}
这是 HTML:
<div class="container">
<section id="frost">
<h2>Frost Bank</h2>
<p>Frost Bank founded in 1868 is based in San Antonio with over 110 financial centers across the state.</p>
<a href="#" class="myButton"><i class="fa fa-search"></i> View</a>
</section>
<section id="shiner">
<h2>Shiner</h2>
<p>Spoetzl Brewery was founded in 1909 in Shiner, Texas. It's the oldest brewery in our Lone Star State.</p>
<a href="#" class="myButton"><i class="fa fa-search"></i> View</a>
</section>
<section id="whataburger">
<h2>Whataburger</h2>
<p>Their first burger stand opened in 1950. They serve fresh food made daily, just like you like it.</p>
<a href="#" class="myButton"><i class="fa fa-search"></i> View</a>
</section>
<section id="costadelmar">
<h2>Costa Del Mar</h2>
<p>Daytona Beach based Costa, specializes in polarized sunglasses for fishing, sailing, and surfing.</p>
<a href="#" class="myButton"><i class="fa fa-search"></i> View</a>
</section>
<section id="honeysucklewhite">
<h2>Costa Del Mar</h2>
<p>Daytona Beach based Costa, specializes in polarized sunglasses for fishing, sailing, and surfing.</p>
<a href="#" class="myButton"><i class="fa fa-search"></i> View</a>
</section>
<section id="morestuff">
<h2>More Stuff</h2>
<p>Take a peek at all the other projects I've worked on. There's a some cool stuff here. Check it out!</p>
<a href="#" class="myButton"><i class="fa fa-search"></i> View</a>
</section>
</div>
这里有两个问题。
问题 #1 在浏览器宽度的某些点,布局变得不稳定,我的行未对齐。在大约 960 像素处是不正确的,然后在 1000 像素处是正确的,然后在 1020 像素处再次发生,然后再次更正。查看照片:
问题 #2 当我将垂直对齐添加到容器时,容器垂直居中正确,但容器向右移动约 10 像素,因此它没有水平居中。见照片。
非常感谢任何帮助。
【问题讨论】:
标签: html css breakpoints susy-compass