html - 当前页面的导航栏突出显示

标签 html css

我想知道如何添加在您当前所在页面的导航栏中添加突出显示框的功能。你知道这样人们就知道他们在哪个页面上。

非常喜欢这个网站,事件页面上有白框:https://woodycraft.net/home/

这是我的导航栏的 CSS:

/*TOP NAV BAR SECTION*/

*{margin: 0px;
  padding: 0px;}

#nav_bar {background-color: #a22b2f;
          box-shadow: 0px 2px 10px;
          height: 45px;
          text-align: center;}

#nav_bar > ul > li {display: inline-block;}

#nav_bar ul > li > a {color: white;
                      display: block;
                      text-decoration: none;
                      font-weight: bold;
                      padding-left: 10px;
                      padding-right: 10px;
                      line-height: 45px;}

#nav_bar ul li ul {display: none;
                   list-style: none;
                   position: absolute;
                   background: #e2e2e2;
                   box-shadow: 0px 2px 10px;
                   text-align: left;}

#nav_bar ul li a:hover {background: #8e262a;}


#nav_bar a:active {background: white;}

#nav_bar ul li:hover ul {display: block;}

#nav_bar ul li ul li a {color: #252525;
                        display: block;}

#nav_bar ul li ul li a:hover {background: #4485f5;
                              color: #fff;}

这是我的一个页面的 HTML:

<!--TOP NAV BAR SECTION-->

                <div id="nav_bar">
                                <ul>
                                  <li><a href="index.html">Home</a></li>
                                  <li><a href="status.html">Status</a></li>
                                  <li><a href="info.html">Info</a></li>

                                  <li><a href="#">Gamemodes</a>                                      
                                <ul>
                                  <li><a href="survival.html">Survival</a></li>
                                  <li><a href="pure-pvp.html">Pure-PVP</a></li>
                                  <li><a href="gamesworld.html">Gamesworld</a></li>
                               </ul>
                                  </li>                                    

                                  <li><a href="rules.html">Rules</a></li>
                                  <li><a href="vote.html">Vote</a></li>
                                  <li><a href="contact.html">Contact</a></li>
                               </ul>
                           </div>

最佳答案

关于html - 当前页面的导航栏突出显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26819675/

相关文章:

HTML 多边形以另一种方式翻转它

javascript - jQuery动画后的图像显示问题

javascript - position:fixed 类与 this.src 冲突

javascript - CSS 和 JavaScript 以内联方式出现在源代码中

php - 我可以使用 .HTACCESS 提交 Html 表单吗?

html - 用没有滚动条的div背景填充页面

html - 附加到网站的字体不适用于苹果设备

javascript - 禁用和启用 html 标签以防止多次点击

html - 不同尺寸的李

html - 带有 Twitter Bootstrap 3 的内联响应式菜单