我已经尝试了很多不同的东西来努力使我的链接工作,但无济于事:(我目前正在为一个学校项目做这件事,这是我第一次尝试编写一个合适的网站。我正在使用崇高文本。
我无法让指向我的主页的链接(在页脚的导航栏中(正常工作,每次我单击它时,它都会显示"找不到文件",并在 url 中带有有趣的符号,如果您链接一个你没有编码的页面。我的所有文件都在同一个文件夹中,不知道出了什么问题......
这是我的 html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="stylesheet_outcome.css">
</head>
<body>
<div class="bgimg"> <img src="outcome_img.png"></div>
<div class="title">
<h1>BACK TO THE FUTURE<br>(1985)</h1>
</div>
<div class="synopsis">
<p><br><br>Marty McFly, a 17-year-old high school<br>student, is accidentally sent thirty years into<br>the past in a time-traveling DeLorean<br>invented by his close friend, the maverick<br>scientist Doc Brown. <br><br><strong>Stars: </strong> Michael J. Fox, Christopher Lloyd.</p>
</div>
<div class="fimg">
<img src="outcome_7_poster.jpg" height="94%" width="94%">
</div>
<footer>
<div class="logo"><img src="logo.png"></div>
<div class="sitemap">
<nav>
<ul>
<p>SITEMAP</p>
<li><a href=“index2.html”><u>Home</u></a></li>
<li><a href=“discover.html”><u>Discover</u></a></li>
<li><a href=“about_us.html”><u>About Us</u></a></li>
<li><a href=“contact.html”><u>Contact</u></a></li>
</ul>
</nav>
</div>
<div class="getintouch">
<ul>
<p>GET IN TOUCH</p>
<li>hello@whattowatch.com</li>
<li>(02)8156 8902</li>
</ul>
</div>
</footer>
</body>
</html>
还有我的 css:
body {
background-color: #852d23;
height: 100%;
overflow: scroll;
}
p {
font-family: Avenir;
font-size: 1.5em;
}
.bgimg {
position: absolute;
float: left;
margin-top: -110px;
}
footer {
position: absolute;
margin-bottom: -300px;
bottom: 0px;
width: 100%;
background-color: #429b99;
color: white;
text-align: center;
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 0.5rem;
font-family: Avenir;
}
ul {
text-align: left;
text-decoration: none;
list-style-type: none;
padding:0px;
line-height: 25px;
}
a {
text-decoration: none;
color: white;
}
li {
color: white;
}
.logo, .sitemap, .getintouch {
float:left;
margin-left: 150px;
left-padding: 150px;
right-padding: 150px;
}
.title {
font-family: Oswald;
font-size: 1.6rem;
font-style: italic;
font-weight: medium;
position:absolute;
top: 250px;
left: 410px;
line-height: 55px;
}
.synopsis {
position:absolute;
top: 325px;
left: 410px;
font-family: Avenir;
font-size: 1rem;
line-height: 1.8rem;
}
.fimg {
position:absolute;
top: 290px;
left: 230px;
}
我认为问题出在您的引号上。
这是您的代码:
<ul>
<p>SITEMAP</p>
<li><a href=“index2.html”><u>Home</u></a></li>
<li><a href=“discover.html”><u>Discover</u></a></li>
<li><a href=“about_us.html”><u>About Us</u></a></li>
<li><a href=“contact.html”><u>Contact</u></a></li>
</ul>
虽然它应该是:
<ul>
<p>SITEMAP</p>
<li><a href="index2.html"><u>Home</u></a></li>
<li><a href="discover.html"><u>Discover</u></a></li>
<li><a href="about_us.html"><u>About Us</u></a></li>
<li><a href="contact.html"><u>Contact</u></a></li>
</ul>
如您所见,我用"
替换了您的“
。这为我解决了问题。
PS:请确保使用验证服务(例如 https://validator.w3.org/#validate_by_input(验证您的代码,因为您的html中有很多错误。