【问题标题】:Links from navigation bar are doubling up on each other来自导航栏的链接彼此加倍
【发布时间】:2013-07-30 16:14:30
【问题描述】:

这是我的代码示例:

<div class="col_1">
            <a href="Shower-Faucets/"><img src="../product_images/shower_head.jpg"/><p >Shower Faucets</p></a href>
        </div>

        <div class="col_1">
            <a href="Bar-faucets/"><img src="../product_images/bar_faucet.jpg"/><p >Bar faucets</p></a href>
        </div>

当我从导航栏转到一个链接时,链接会堆积起来,从而断开链接。

发生的事情的例子:

www.Website.com
www.Website.com/Shower-Faucets/
www.Website.com/Shower-Faucets/Bar-faucets/

应该发生的事情的例子:

www.Website.com >
www.Website.com/Shower-Faucets/ >
www.Website.com/Bar-faucets/

【问题讨论】:

  • 此导航栏是否应用了 CSS/JS?您没有为导航项使用朴素和无序列表的任何原因?

标签: html drop-down-menu menu hyperlink navigation


【解决方案1】:

您想在 href 的开头添加一个“/”。这将使链接基于您的地址。

<a href="/Shower-Faucets">
<a href="/Bar-faucets">

如果没有反斜杠,url 似乎是相对于您当前所在的位置,因此是地址的堆叠。

【讨论】:

  • 我要等几分钟
猜你喜欢
  • 2021-08-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-02-06
  • 2014-08-05
相关资源
最近更新 更多