user3261619 user3261619 -4 years ago 85
CSS Question

html code links where it should not?

My problem here is that I have a menu i made in html with some links in the body but when i got to make another tag after the nav tag the last link Contact seems to still keep linking without me doing so. I looked around on google and couldn't seem to find anything where the link persists without me linking it specifically in a . I feel like it is most likely to do with my understanding of the fundamentals since i started html recently.
Here is the code:

<html>

<head>
<title>Company</title>
<link rel="stylesheet" href="Style.css">
</head>

<body>
<nav id="menu">
<ul>
<li><a href="Home.html">Home</li>
<li><a href="Products.html">Products</li>
<li><a href="About Us.html">About us</li>
<li><a href="Contact.html">Contact us</li>
</ul>
</nav>
<h1>1</h1>
</body>

</html>


My stylesheet, if the problem occured there?:

#menu nav{
position:fixed;

margin:0;
padding:0;
border:0;

}

#menu ul{
list-style:none;
margin:0;
padding:0;
display:flex;
border:2px;
border-style:solid;
background-color:#ccc;
justify-content:space-around;
}

#menu ul li{
display:inline;

margin:0;
padding:0;
}

#menu li a{
display:inline-block;
list-style:none;
margin:0;
padding:0;
border:0;
text-decoration:none;
font-size:2em;
color:blue;
}

#menu li a:hover{
margin:0;
padding:0;
border:0;
text-decoration:underline;
color:#cdg;

}

Answer Source

You are missing your closing for each of your links.

Update:

        <li><a href="Home.html">Home</li>
        <li><a href="Products.html">Products</li>
        <li><a href="About Us.html">About us</li>
        <li><a href="Contact.html">Contact us</li>

To:

            <li><a href="Home.html">Home</a></li>
            <li><a href="Products.html">Products</a></li>
            <li><a href="About Us.html">About us</a></li>
            <li><a href="Contact.html">Contact us</a></li>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download