简体   繁体   English

重叠的HTML边框底部

[英]Overlap HTML border bottom

I'm making a Navigation bar. 我正在制作一个导航栏。 It has a border at the bottom. 它的底部有边框。 Now I want to give the active class a other color for the border. 现在,我想给活动类其他边框颜色。 It should be in place of the navigation border, but it shows above it. 它应该代替导航边框,但显示在其上方。

在此处输入图片说明

How can I put the blue line on the place of the green line under the active Home button and keep green at the rest? 如何在活动的“主页”按钮下将蓝线放在绿线的位置,并在其余位置保持绿色?

CSS Code: https://gist.github.com/matthijs110/9859d4e2a3983383bbb0 CSS代码: https//gist.github.com/matthijs110/9859d4e2a3983383bbb0

HTML Code: https://gist.github.com/matthijs110/a09c4cb045eebeb89a4a HTML代码: https//gist.github.com/matthijs110/a09c4cb045eebeb89a4a

This is pretty simple.. You just need to set the margin-bottom: -3px . 这非常简单..您只需要设置margin-bottom: -3px

Your CSS should look like this: 您的CSS应该如下所示:

.navbar {
    border-bottom: 3px solid #5cb85c;
    width: auto;
}

.active {
    border-bottom: 3px solid #5bc0de;
    margin-bottom: -3px;
}

Here's a fiddle: http://jsfiddle.net/4NLYZ/ 这是一个小提琴: http : //jsfiddle.net/4NLYZ/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM