简体   繁体   English

如何在 css 中的导航栏项下添加一个块

[英]how do I add a block beneath navbar-item in css

I want to have a little block beneath the active page (and hover), in the navbar ofcourse.我想在活动页面(和悬停)下方有一个小块,当然在导航栏中。 It should look like this:它应该是这样的:

在此处输入图片说明

This is the code that I have so far.这是我到目前为止的代码。 I think that the border-bottom needs to be very small, with a big thickness.我认为边框底部需要非常小,厚度很大。

.navbar .navbar-nav > li > a:hover {
color:#008080;
background:rgba(255,255,255, 0.0);
border-bottom: 5px solid rgb(255, 128, 0);

} }

I hope someone can help with this.我希望有人可以帮助解决这个问题。

So the best way I can see would be to make a div within the navbar li Something like:所以我能看到的最好方法是在导航栏 li 中创建一个 div 类似的东西:

 <div class="navbar"> <li>Home <div class="square"></div> </li>

And then give that div the styles of:然后给那个 div 样式:

 .square { display:none; width:50%; margin:0 auto; background: orange; height:20px; } .square:hover { display:block; }

That should make it appear when you hover over the square itself.当您将鼠标悬停在正方形本身上时,它应该会出现。 You might have to use a javascript mouseover events if you want to make it appear when you hover over the whole li tag如果您想让鼠标悬停在整个 li 标签上时出现,您可能必须使用 javascript 鼠标悬停事件

Does that help at all?这些帮助有用?

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

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