如果你看看twoguysplayingzelda.com,你会注意到我的菜单上有一个顶部和底部边框,只延伸到最后一个菜单项。我希望这个边框不是整个页面,而是从左侧窗口的左侧到侧边栏的右侧。如果这令人困惑,只需看看左侧和右侧的事物是如何对齐的,希望它有意义。我的CSS代码如下。谢谢你的帮助!
div.navigation.section.no-padding.bg-dark { background: #ffffff; }
.main-menu {
font-family: 'Arial', sans-serif;
font-size: 1.0em;
text-align: center;
}
.main-menu li { position: relative; }
.main-menu > li { float: left; }
.main-menu > li:before {
content: none;
display: block;
position: absolute;
right: 0;
top: 50%;
margin-top: -18px;
margin-right: -13px;
}
.main-menu > li:last-child:before { content: none; }
.main-menu > li > a {
display: block;
padding-top: 12px;
padding-bottom: 12px;
padding-left: 12px;
padding-right: 12px;
font-size: 1.0em;
color: #000000;
text-transform: uppercase;
letter-spacing: 1px;
font-weight: 400;
border-bottom: 1px solid #808080; (here is my bottom border)
border-top: 1px solid #808080; (here is my top border)
width: 100%; (I thought this would do the trick but it didn't)
}
.main-menu > li:first-child > a { margin-left: 0; }
.main-menu > .has-children > a,
.main-menu > .page_item_has_children > a { padding-right: 20px; position:
relative; }
.main-menu > .has-children > a::after,
.main-menu > .page_item_has_children > a::after {
content: "";
display: none;
border: 5px solid transparent;
border-top-color: #999;
position: absolute;
z-index: 1001;
right: 29px;
top: 50%;
margin-top: -2px;
}
.main-menu li:hover > a {
cursor: pointer;
background: #01B3D9;
color: #000000; }
.main-menu > .has-children:hover > a::after,
.main-menu > .page_item_has_children:hover > a::after { border-top-color:
#fff; }
答案 0 :(得分:0)
边框位于.main-menu > li > a
个元素上,您需要将其删除。
然后将边框添加到包含元素,即div.navigation-inner.section-inner
,但是您应该添加另一个类来添加边框样式,因为您在一个地方使用navigation-inner section-inner
。< / p>