Like the header says, i have tried making my dropdown-content come under of the dropdown hover but it keeps going to the side of the navbar when i actually want it to come under the navbar, how do i make this happen? I tried changing the display on .dropdown:hover .dropdown-content element and it changed but not as i wanted it to so maybe it's that one that makes the faulty input?
<div class="topnav-centered">
<a href="./index.html" > < website /> </a>
</div>
<div class="topnav-item">
<div class="dropdown">
<a href="#">Projects</a>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
<a href="#">Link 4</a>
</div>
</div>
<a href="#">Knowledge</a>
<a href="#">Contact</a>
<a href="#">About me</a>
</div>
</div>
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0, 2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {
background-color: #f1f1f1;
}
.dropdown:hover .dropdown-content {
display: inline-table;
}
.topnav {
position: fixed;
background-color: #EAEAEA;
top: 0;
width: 100%;
box-shadow: 5px 5px 100px grey;
}
.topnav a {
float: left;
color: #4E4B50;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 14px;
font-family: sans-serif;
transition: 0.3s;
}
.topnav a:hover {
color: #7F7F7F;
}
.topnav-centered a {
float: none;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 20px;
transition: 0.3s;
font-family: sans-serif;
}
.topnav-centered a:hover{
float: none;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.topnav-right {
float: right;
} ```