简体   繁体   English

页脚链接无法在html中使用

[英]Footer links not working in html

I've tried so many different things in an effort to make my links work, but to no avail:( I'm currently doing this for a school project and this is my first time trying to code a proper site. I'm using Sublime Text. 为了使我的链接正常工作,我尝试了许多不同的尝试,但无济于事:(我目前正在为一个学校项目进行此操作,这是我第一次尝试编写合适的网站。我正在使用崇高的文字。

I can't get the links to my home page (in the nav bar in footer) to work properly, everytime I click on it, it says "file not found" with the funny symbols in the url that you get if you link a page you haven't coded. 我无法链接到首页(在页脚的导航栏中)以正常工作,每次单击该链接时,都会显示“找不到文件”,并在您链接的网址中显示有趣的符号您尚未编码的页面。 All my files are in the same folder and have no clue what's wrong... 我所有的文件都在同一个文件夹中,不知道出了什么问题...

Here's my html: 这是我的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>

And my css: 而我的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;
}

I think the problem lies in your quotation marks. 我认为问题出在您的引号上。

This is your code: 这是您的代码:

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

While it should be: 虽然应该是:

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

As you can see I replaced your with " . That solved the issue for me. 正如你可以看到我换成你" ,即解决了这个问题对我来说。

PS: Please make sure to validate your code with validation services such as https://validator.w3.org/#validate_by_input as you have a lot of errors in your html. PS:请确保使用诸如https://validator.w3.org/#validate_by_input之类的验证服务来验证您的代码,因为您的html中有很多错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM