页脚链接在 html 中不起作用

Footer links not working in html

为了使我的 link 工作,我尝试了很多不同的方法,但无济于事:(我目前正在为一个学校项目做这件事,这是我第一次尝试编写一个合适的网站。我正在使用 Sublime Text。

我无法让 link 进入我的主页(在页脚的导航栏中)以正常工作,每次我点击它时,它都会显示 "file not found" 和有趣的符号在 url 如果您 link 一个您没有编码的页面。我的所有文件都在同一个文件夹中,不知道哪里出了问题...

这是我的 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.

中有很多错误