Hello everyone! I am diving into the world of HTML and CSS, but I've hit a roadblock. Despite searching through various resources and forums, I can't seem to find a solution to my problem.
The issue at hand involves an irritating space in my navigation bar that I just can't seem to eliminate.
To make things clearer, I've set the background of the nav element to blue so you can easily spot the troublesome area. Here's a visual representation:
Providing further clarity, here is the HTML code snippet:
<div class="topnavbar">
<ul class="nav">
<li class="nav-element"><a href="main.html">Home</a></li>
<li class="nav-element"><a href="#blog">Blog</a></li>
<li class="nav-element"><a href="#about">About Me</a></li>
<li class="nav-element"><a href="#services">Services</a></li>
<li class="nav-element"><a href="#testimonials">testimonials</a></li>
<li class="nav-element"><a href="#contact">Contact</a></li>
</ul>
</div>
Additionally, this is the accompanying CSS code:
.topnavbar{
background-color: blue;
border-top: 5px solid black;
border-bottom: 5px solid black;
position: relative;
margin-left: auto;
margin-right: auto;
width:90%;
border-top-left-radius: 30px;
border-bottom-left-radius: 30px;
border-top-right-radius:30px;
border-bottom-right-radius:30px;
}
body {
top:1px;
background-color: black;
}
ul {
list-style-type: none;
padding: 0;
margin:0;
border-radius: 5px;
overflow: hidden;
}
li {
float: left;
border-radius: 5px;
}
a:link, a:visited {
display: inline-block;
width: 150px;
font-weight: bold;
color: #000000;
background-color: #ffffff;
text-align: center;
padding: 4px;
text-decoration: none;
text-transform: uppercase;
}
a:hover, a:active {
background-color: #FA0000;
}