【问题标题】:Unable to link page to the other pages with two navigation bar in the same page无法将页面链接到同一页面中具有两个导航栏的其他页面
【发布时间】:2020-12-18 13:05:12
【问题描述】:

有人可以帮助我吗?我在一个页面中有两个不同的导航栏,可以将该页面链接到另一个页面。但是其中两个位于不同的位置,一个在顶部,另一个在底部。

*对于底部,我只是将导航栏的编码替换为“b href”以表示临时性,并希望寻求您的解决方案”

下面是我的代码:

在页面顶部(导航条编码)

  <label for="home" class="home"><a href=" "><i class="fas fa-home"></i>Home</a ></label>

  <label for="tours" class="tours"><a href="tours.html"><i class="fas fa-route"></i>Tours</a ></label>

  <label for="destination" class="destination"><a href="destination.html"><i class="fas fa-plane-arrival"></i>Destination</a ></label>

 <label for="aboutus" class="aboutus"><a href="aboutus.html"><i class="far fa-address-card"></i>About Us</a ></label>

 <label for="contact" class="contact"><a href="contact.html"><i class="far fa-envelope"></i>Contact</a ></label>

页面底部(导航条编码) (我知道没有任何名为“b href”的超链接,所以我只是临时替换了它

    <li><b href="#" class="homebottom">Home</b></li>
        <li><b href="destination.html">Destination</b></li>[enter image description here][1]
        <li><b href="tours.html">Tours</b></li>
        <li><b href="aboutus.html">About Us</b></li>
        <li><b href="contact.html">Contact</b></li>

    </ul>

结论:如何在不影响现有导航栏的情况下设置两个导航栏的样式?

bottom part navigation bar

top part navigation bar

【问题讨论】:

  • 你能把你的问题说得更好吗?你到底想做什么?
  • 嗨,实际上我在一个页面中有两个不同的导航栏,它们位于不同的位置。其中一个导航栏我会使用“a href”成功地将页面链接到其他页面,但另一个导航栏因为位置不同,所以我必须在不同的“div”中声明,即“b href”但导航栏无法将页面链接在一起。有没有其他方法可以用不同的编码链接另一个导航栏?
  • 如何在不影响现有导航栏的情况下设置两个导航栏的样式?

标签: html css


【解决方案1】:

如果您将id 添加到唯一的导航元素,例如topNavbottomNav。然后你可以使用唯一的 ID 来定位具有不同 css 的不同元素。

<ul id="topNav">
...
<ul id="bottomNav">

ul#topNav {}
ul#bottomNav {}

这种技术有时被称为伪命名空间。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-07-08
    • 1970-01-01
    • 2016-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多