我想构建一个适合 Susy Grid 的类似 android 的主导航。它看起来像这样:
代码在这里:
HTML:
<div class="container">
<nav>
<ul class="horizontal-list">
<li>
<a href="#">One</a>
</li>
<li>
<a href="#">Two</a>
</li>
<li>
<a href="#">Three</a>
</li>
<li>
<a href="#">Four</a>
</li>
</ul>
</nav>
</div>
萨斯:
header.main {
height: $headerHeight;
background: url('images/headerBackground.gif');
.container {
@include container;
@include susy-grid-background;
nav {
@include span-columns(8);
ul.horizontal-list {
@include horizontal-list;
overflow: visible;
li {
@include isolate-grid(2, 8);
padding: 0;
display: table;
a {
// vertical alignment
display: table-cell;
height: $headerHeight / 2;
padding-bottom: 2px;
vertical-align: bottom;
// appearance
color: $greyLight;
font-size: 18px;
text: {
transform: uppercase;
decoration: none;
}
// hover
position: relative;
&:before {
content: '';
display: block;
width: $headerUnderlineGap;
background: $black;
height: $headerHeight;
position: absolute;
top: 0;
margin-left: -$headerUnderlineGap + 1;
}
&:hover {
color: $white;
&:after {
content: '';
display: block;
background: $cyanLight;
width: 114%; // TODO check why space(2, 8) does not work
height: 4px;
position: absolute;
margin: -1px 0 0 1px;
}
}
}
}
}
}
}
}
&:after
我觉得将元素的宽度设置为114%
而不是space(2, 8)
. 谁能告诉我,如何设置一个带有 Susy 网格和连续下划线的水平导航,它一直悬停到下一个 li 元素。
提前致谢!