【发布时间】:2017-10-21 10:08:22
【问题描述】:
我正在制作一个侧边栏,它需要在每个 li 元素之后有一个底部边框,除了最后一个元素。但是 Bootstrap 4 已经在 list-group-items 上有边框,如果我添加border-0,它会完全删除它们。而且我似乎无法弄清楚如何通过 CSS 编辑它,所以它可以工作。它只在最后一个 li 元素之后显示一个底部边框。
这是我正在尝试制作的快速图像预览:
这是我的代码:
.sidebar {
position: fixed;
z-index: 9999;
}
.menu {
position: fixed;
background-color: #fff;
height: 100vw;
width: 90px;
top: 60px;
overflow: hidden;
.list-group-item {
border: 0;
}
a {
color: gray;
font-size: 16px;
span {
white-space: nowrap;
}
}
}
.menu:hover {
width: 260px;
}
<div class="sidebar">
<ul class="list-group flex-column d-inline-block menu">
<li class="list-group-item py-2">
<a href="#">
<span class="align-middle"><img src="https://placehold.it/50x50" height="50" class="mr-4">Text</span>
</a>
</li> <!-- /.list-group-item -->
<li class="list-group-item py-2">
<a href="#">
<span class="align-middle"><img src="https://placehold.it/50x50" height="50" class="mr-4">Text</span>
</a>
</li> <!-- /.list-group-item -->
<li class="list-group-item py-2">
<a href="#">
<span class="align-middle"><img src="https://placehold.it/50x50" height="50" class="mr-4">Text</span>
</a>
</li> <!-- /.list-group-item -->
</ul>
</div> <!-- /.sidebar -->
【问题讨论】:
-
哦,好吧!我将添加 SCSS 标记。
标签: html css twitter-bootstrap sass bootstrap-4