<a tag="" in="" html="" is="" not="" working="" with="" <div="" class="subnav">

时间:2016-03-26 08:25:19

标签: html

I'm writing a code for my website in html.when I use < a tag as below its not working (bad).

<div id="column">
  <div class="subnav">


      <li><a href="Introduction To File.html">Introduction To File</a></li>


          <li><a href="File Access Mode.html">File Access Mode</a></li>
          <li><a href="Error in opening file.html">Error Handling</a></li>
          <li><a href="#">Closing File</a></li>
          <li><a href="End of file.html">End of File</a></li>
          <li><a href="fcloseall() vs exit().html">fcloseall() vs exit()</a></li>
          <li><a href="getchar() and putchar().html">getchar() and putchar()</a></li>
          <li><a href="getc() and putc().html">getc() and putc()</a></li>
          <li><a href="fputc() and fgetc().html">fputc() and fgetc()</a></li>
          <li><a href="fgets.html">fgets()</a></li>

  </div>
</div>

NOTE: when I click on Introduction To File i am not sent to Introduction To File.html page(bad) but, when i insert

<div class="clear"></div> 

then i m sent to Introduction To File.html page and the problem is after adding "clear" some unwanted space seems to be added which is bad.

Please help to find where i went wrong?

2 个答案:

答案 0 :(得分:0)

您的HTML无效。 <div>元素不能是<ul>的子元素。它们必须包含在 $(".all, .active, .offline").mouseenter(expand); $(".all, .active, .offline").mouseleave(shrink);

此外,you need to encode the spaces in your URL to %20.这是空格的字符编码。否则它将被误解为你找到的。

URL Encoding

答案 1 :(得分:0)

在查看评论中提供的链接后,问题很简单。您的div标识为container,此div会覆盖在您的左侧菜单上。所以它就像左侧菜单上方的隐形包装。所以你永远无法点击锚标签。将此CSS规则放在您的代码中,它必须正常工作

这里你已经有了这个

  #header, #topbar, #topnav, #breadcrumb, #container, #footer, #copyright {
    position: initial;
    margin: 0 auto 0;
    display: block;
    width: 96%;
  }

添加此CSS规则以覆盖上述position:relative规则。

 #container {
     position: initial; 
    }

使用上面的代码删除重叠,您可以单击链接。

要快速检查,请将其粘贴到浏览器控制台中,您可以看到这些链接是可点击的。

$('#container').css('position','initial');