gpt4 book ai didi

HTML 超链接在导航栏中不起作用

转载 作者:行者123 更新时间:2023-11-28 17:05:27 25 4
gpt4 key购买 nike

我的 HTML 超链接在我的网页的导航栏上不起作用。我逐渐转移了我的样式表脚本,发现添加CSS文件后,超链接无法指向网页。起初我发现 导航菜单 slider 部分 重叠了(这个问题在之前的 StackOverflow 问题中提到过),但我指定了一个导航菜单本身的高 z-index。对不起,如果代码很长,但我必须提供所有代码以查看出了什么问题。请尝试帮助使响应成为实际修复,而不是仅仅删除其中一个元素来停止覆盖。

HTML

<div id="container">
<header>
<h1><b>Seattle</b>&Metropolitan</h1>
<nav>
<ul>
<li><a href="about.html">About</a></li>
<li>Buildings</li>
<li id="contact">Contact Us</li>
</ul>
</nav>
</header>
</div>
<div class="image-section">
<img src="img/seattleskyline.jpg" alt="Seattle Skyline" id="center-image" />
<div id="caption">A panoramic view of 1201 Third Avenue at night</div>
<button id="sliderLeft" onclick="left();"></button>
<button id="sliderRight" onclick="right();"></button>
</div>
<br><br>
<div class="content">
Seattle's history can be traced back to the 1850s, when pioneers and natives started building a great city filled with a diverse culure, beautiful scenery, and a vibrant enviornment. The metropolitan area of Seattle now is a high-tech hub, in which four Fortune 500 companies reside: <a href="http://www.amazon.com/" alt="Amazon Website"><b>Amazon.com (#49)</b></a>, <a href="http://www.starbucks.com" alt="Starbucks Website"><b>Starbucks (#208)</b></a>, <a href="http://shop.nordstrom.com" alt="Nordstrom Website"><b>Nordstrom (#227)</b></a>, and <a href="http://www.expeditors.com" alt="Expeditors Website"><b>Expeditors International (#428)</b></a>.
</div>

CSS

@charset "utf-8";

body
{
margin: 0;
padding: 0;
font-family: Open Sans, sans-serif;
}

#container
{
width: 75%;
margin-left: auto;
margin-right: auto;
}

header h1
{
font-size: 38px;
float: left;
font-weight: 100;
}

header nav ul
{
list-style-type: none;
margin: 0;
vertical-align: middle;
line-height: normal;
float: right;
z-index: 999;
}

header nav ul li
{
line-height: 105px;
display: inline;
padding: 45px;
font-size: 22px;
font-weight: 100;
}

header nav ul li a
{
color: black;
text-decoration: none;
}

#center-image
{
width: 100%;
height: 480px;
}

#contact
{
padding-right: 0;
}

.image-section
{
margin-left: auto;
margin-right: auto;
width: 75%;
position: relative;
text-align: center;
}

.image-section #caption
{
position: absolute;
display: none;
bottom: 4px;
width: 100%;
text-align: center;
color: white;
background: #474747;
height: 50px;
line-height: 50px;
opacity: 0.8;
font-size: 20px;
}

.image-section button
{
outline: 0;
}

.image-section #sliderLeft
{
position: absolute;
display: none;
width: 25px;
height: 100px;
top: 50%;
margin-bottom: 50px;
left: 0;
opacity: 0.7;
border: 0;
}

.image-section #sliderRight
{
position: absolute;
display: none;
width: 25px;
height: 100px;
top: 50%;
margin-bottom: 50px;
right: 0;
opacity: 0.7;
border: 0;
}

.content
{
margin-left: auto;
margin-right: auto;
width: 75%;
font-size: 18px;
line-height: 35px;
}

.content a
{
text-decoration: none;
color: black;
}

.content a:visited
{
color: black;
}

最佳答案

您的问题出在 .image-section 上。

我通过更改 background-color:yellow;

发现

显然链接是在后台推送的。

要修复它,请将 z-index:-1; 添加到 .image-section

enter image description here

关于HTML 超链接在导航栏中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30419338/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com