gpt4 book ai didi

css - 以前有效的链接现在无效

转载 作者:太空宇宙 更新时间:2023-11-04 08:43:36 24 4
gpt4 key购买 nike

所以我正在为一个学校元素制作一个 html5 网页,我之前可以使用的一些超链接已经完全损坏,以至于连 a:hover 属性都不起作用。

这是我的“关于”页面的确切代码(包括评论),左侧的超链接在该页面上起作用:

@charset "UTF-8";
/* CSS Document */

#container {
width:1024px;
height:800px;
background-image:url(Images/All%20Pages/Background.png);
}

header{
width:1024px;
height:100px;
text-align:left;
font-family:Georgia, "Times New Roman", Times, serif;
background-image:url(Images/All%20Pages/Top_Banner.png);s
display:inline;
}

footer{
width:1024px;
height:80px;
font-family:Georgia, "Times New Roman", Times, serif;
text-align:center;
background-image:url(Images/All%20Pages/Bottom_Border.png);
}

#content{
width:869px;
height:620;
padding-left:155px;
padding-bottom:80px;
position:absolute;
font-family:Georgia, "Times New Roman", Times, serif;
text-align:center;
}

h2{
color:#FFF;
}

h4{
color:#FFF;
}

p{
color:#FFF;
}

#left_bar{
background-image:url(Images/All%20Pages/Sidebar.png);
height:700px;
width:155px;
text-align:center;
}

a{
text-decoration: none;
color:#FFF;
}

a:hover{
color:#000;
text-decoration: none;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="About.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>[Title Goes Here]</title>
</head>

<body>
<div id="container">

<header>
<div style="line-height:5%;">
<br>
</div>
<h2><a href="Title Goes Here.html" id="current">[Title Goes Here]:</a></h2>
<h4>Adventures in Design</h4>
</header>
<!-- CONTENT DIV HERE -->

<div id="left_bar">
<br />
<h2><a href="#" id="current">ABOUT</a></h2>
<br />
<h2><a href="#">PORTFOLIO</a></h2>
<br />
<h2><a href="#">CONTACT</a></h2>
</div>


<footer>
<br />
<p>Last Updated: 05-08-2017</p>
</footer>

</div>

</body>
</html>
<!--<div style="border-left:1px solid #000;height:500px"></div>
for vertical line -->

这是我主页的完整代码,其中只有返回主页的链接有效:

@charset "UTF-8";
/* CSS Document */

#container {
width:1024px;
height:800px;
background-image:url(Images/All%20Pages/Background.png);
}

header{
width:1024px;
height:100px;
text-align:left;
font-family:Georgia, "Times New Roman", Times, serif;
background-image:url(Images/All%20Pages/Top_Banner.png);s
display:inline;
}

footer{
width:1024px;
height:80px;
font-family:Georgia, "Times New Roman", Times, serif;
text-align:center;
background-image:url(Images/All%20Pages/Bottom_Border.png);
}

#content{
width:869px;
height:620;
padding-left:155px;
padding-bottom:80px;
position:absolute;
font-family:Georgia, "Times New Roman", Times, serif;
text-align:center;
}

h2{
color:#FFF;
}

h4{
color:#FFF;
}

p{
color:#FFF;
}

#left_bar{
background-image:url(Images/All%20Pages/Sidebar.png);
height:700px;
width:155px;
text-align:center;
}

a{
text-decoration: none;
color:#FFF;
}

a:hover{
color:#000;
text-decoration: none;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="Front_Page.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>[Title Goes Here]</title>
</head>

<body>
<div id="container">

<header>
<div style="line-height:5%;">
<br>
</div>
<h2><a href="Title Goes Here.html" id="current">[Title Goes Here]:</a></h2>
<h4>Adventures in Design</h4>
</header>

<div id="content">
<h2> Hello and welcome to [Title Goes Here], <br />
one adventure in design, from websites to photos and beyond!</h2>
<div style="line-height:217px;">
<br />
</div>
<img src="Images/Front Page/Landscape.png" />
</div>

<div id="left_bar">
<br />
<h2><a href="About.html" id="current">ABOUT</a></h2>
<br />
<h2><a href="#">PORTFOLIO</a></h2>
<br />
<h2><a href="#">CONTACT</a></h2>
</div>

<footer>
<br />
<p>Last Updated: 05-08-2017</p>
</footer>

</div>

</body>
</html>

任何对此的回答将不胜感激,因为我还没有发现任何错误。预先感谢您给我的任何建议

最佳答案

需要注意两点:

首先,您的链接 href 格式不正确。

href="Title Goes Here.html"

通常,最佳做法是省略文件名中的空格并用破折号代替。

href="title-goes-here.html"

其次,在为图片等内容编写 URL 路径时,如果目标是从相对根目录中抓取文件,则应在所有 URL 前加上正斜杠。

background-image:url(/Images/All%20Pages/Background.png);

关于css - 以前有效的链接现在无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43943284/

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