簡體   English   中英

如何使鏈接的點擊位置絕對可點擊?

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

我終於在此頁面上使用絕對位置居中顯示徽標,但是現在我的“某些鏈接”不可點擊。 我試圖將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:

#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; }

它們不可單擊,因為它們不是鏈接( <a> ),而是具有href屬性的div。

您的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