简体   繁体   English

菜单中的绝对链接/相对链接均无效

[英]Neither Absolute Links/Relative Links Won't Work in Menu

I'm brushing up my html basics and I'm using a template to practice, here's my question with regards to reveal (uses jquery) menu: 我正在整理自己的html基础知识,并且正在使用模板进行练习,这是我关于显示(使用jquery)菜单的问题:

    <ul>
        <li class="home-link"><a href="http://example.com">Home</a></li>
        <li><a href="http://example.com/alpha.html">Alpha</a></li>
        <li><a href="http://example.com/beta.html">Beta</a></li>
    </ul>

When the page is loaded and I click on the links nothing happens, the only one that works is home. 加载页面并单击链接时,没有任何反应,唯一起作用的是首页。 In the example they use these type of links instead and they all work properly: 在示例中,他们改用以下类型的链接,并且它们都可以正常工作:

    <ul>
        <li class="home-link"><a href="http://example.com">Home</a></li>
        <li><a href="http://example.com/alpha">Alpha</a></li>
        <li><a href="http://example.com/beta">Beta</a></li>
    </ul>

They seem to be pointing to a folder instead? 他们似乎指向的是文件夹吗? I've tried everything, relative, absolute, but nothing. 我已经尝试了一切,相对的,绝对的,但是什么也没有。 Did they change the htaccess file? 他们更改了htaccess文件吗? When I make a link outside of the menu div they work absolutely fine. 当我在div菜单外建立链接时,它们的工作原理就非常好。

Any pointers, tips, hints? 有任何指示,技巧,提示吗? Thanks. 谢谢。

Edit: I applied the style to the other links as suggested but it didn't work. 编辑:我按照建议将样式应用于其他链接,但是没有用。 What's weird is that if I right-click and open the links they work. 奇怪的是,如果我右键单击并打开链接,它们将起作用。

Guessing it's to do with styling as I see you have a class on Home and home seems to be the only one that is working. 猜想这与样式有关,因为我看到您有一门关于Home的课程,而home似乎是唯一可以使用的课程。

Try adding that same class on the other links and see if it works. 尝试在其他链接上添加相同的类,看看是否可行。

Also, if you're using position: absolute on one of the links and it remains unclickable, try adding a higher z-index to it [Not recommended as a permanent fix but rather to find the root of the problem]. 另外,如果您在其中一个链接上使用position:absolute,并且仍然无法单击,请尝试向其添加更高的z-index [不建议作为永久性解决方法,而是寻找问题的根源]。

CSS-Tricks has an excellent guide to understanding position properties. CSS-Tricks为了解位置属性提供了出色的指南。

Edit: To clarify, add class="home-link" to the other li tags 编辑:要澄清,将class =“ home-link”添加到其他li标签

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

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