简体   繁体   English

如何使链接的点击位置绝对可点击?

[英]How to make links click-able with position absolute?

I finally got my logo at this page centered by using position absolute, but now my "Some links" aren't clickable. 我终于在此页面上使用绝对位置居中显示徽标,但是现在我的“某些链接”不可点击。 I've tried to add z-index to the menu_small div but it doesn't help. 我试图将z-index添加到menu_small div中,但这无济于事。

<div id="menu">
            <div id="logo"><a class="logo" href="index.php"> THIS IS A SITE! </a></div>
            <div id="menu_small" href="xxxxx.php" style="margin-right: 10%; float: right;">Some link 1</div>
            <div id="menu_small" href="xxxx.php" style="margin-left: 10%; float: left;">Some link 2</div>
</div>

CSS: CSS:

#menu{
width: 100%;
height: 90px;
float: left;
background: rgb(255, 255, 255);
background: rgba(255, 255, 255, .82);
margin-right: 60px;
z-index: 1; }

#menu_small{
margin-top: 37px;
font-size: 18pt;
z-index:30; }

#logo{
width: 100%;
height: auto;
position: absolute;
font-size: 38pt;
line-height: 90px;
text-align: center;
z-index: 2; }

.logo{
width: auto;
height: auto; }

They are not clickable, because they are not links ( <a> ), but divs with href attributes. 它们不可单击,因为它们不是链接( <a> ),而是具有href属性的div。

Your HTML should look something like this: 您的HTML应该如下所示:

<div id="menu_small" style="margin-left: 10%; float: left;">
  <a href="xxxx.php">Some link 2</a>
</div>

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

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