【发布时间】:2016-05-21 10:36:17
【问题描述】:
我创建了一个带有子导航的导航,请参阅JSFiddle with subnavigation。我有一个问题,在黄色背景的顶部导航和红色背景的子导航之间,我希望有1px solid white 的距离来分隔两个区域。目前使用这个 CSS 定义
html, body {
background-color: green;
}
我尝试在 <nav class="top-bar" data-topbar> 周围放置另一个 div 并设置 background-color: white; 但没有成功。
目标是在.top-bar 区域下方始终有一条 1 像素的实线。因此,当没有显示子导航时,请参阅JSFiddle without subnavigation,应该有这个分隔符。我试着用
.top-bar {
background: yellow;
border-bottom: 10px solid white; /*10px only to see that the border is inside the box*/
}
但边框不在黄色top-bar 框之外,它在里面,我不想拥有。此外,最好有一个组合,以便顶部和 sb 导航之间的 1px 空白始终存在。
【问题讨论】:
标签: html css navigationbar