Html 一个 href 不可点击

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14408543/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 05:03:24  来源:igfitidea点击:

a href not clickable

htmlwordpresswordpress-themingz-indexhref

提问by stevenspiel

I have a simple blog on wordpress http://heather.stevenspiel.com/and I'm trying to make the header title to be a link to the homepage. I went into header.php and rewrote the script for that part, but still can't get a link to work.

我在 wordpress http://heather.stevenspiel.com/上有一个简单的博客,我试图将标题标题设为主页的链接。我进入 header.php 并重写了该部分的脚本,但仍然无法获得工作链接。

This is what I re-wrote:

这是我重新写的:

<h1>
   <a href="http://heather.stevenspiel.com/" style="cursor:pointer !important;">My Spiel</a>
  <br/>&nbsp;
</h1>

I know that the href is being registered because of the css color change.

我知道由于 css 颜色变化,href 正在被注册。

This is what the previous code was:

这是之前的代码:

    <h1>
        <?php
            if ($balloons_option['balloons_site-title_line1'] == '' && $balloons_option['balloons_site-title_line2'] == '') { ?>
            This is a<br />
            WordPress theme
        <?php } else {
            echo $balloons_option['balloons_site-title_line1']; ?><br />
            <?php echo $balloons_option['balloons_site-title_line2'];       
        } ?>
    </h1>

I originally tried putting the href outside the h1, but still no luck.

我最初尝试将 href 放在 h1 之外,但仍然没有运气。

Is there some buried Wordpress setting that disables a clickable title? Or is there some javascript that I should be looking out for that is disabling it?

是否有一些隐藏的 Wordpress 设置会禁用可点击的标题?或者是否有一些我应该注意的 javascript 正在禁用它?

I should also note the css for the header contains a z-index. I read somewhere that it might be effected by that:

我还应该注意标题的 css 包含一个 z-index。我在某处读到它可能会受到影响:

#header .content {
line-height: 18px;
margin: 0;
z-index: 4;
}

If the z-index is effecting it, why is that?

如果 z-index 影响它,为什么会这样?

回答by Christopher Marshall

Change z-index property on line 37of layout.css to

line 37将 layout.css 的z-index 属性更改为

#header h1 {
position: relative;
z-index: 10; /* Was 2 */
}

Your .entry(z-index:4) div goes vertically from top to bottom covering your #headerwith a higher z-indexthan your h1 z-index (2). So your h1/Anchor wsa unclickable because it was "under" another div.

.entryz-index:4)DIV从顶部垂直进入底部覆盖你#header具有较高的z-index比你的H1的z-index (2)。所以你的 h1/Anchor 无法点击,因为它在另一个 div 的“下”。