Search code examples
htmlcsshyperlinkwebfooter

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:

<!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>[email protected]</li>
                    <li>(02)8156 8902</li>
            </ul>
            </div>

        </footer>
    </body>
</html>

And my 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;
}

Solution

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