Despite numerous challenges, I finally succeeded in getting my dropdown buttons positioned at the top of the screen, fitting into the navbar, and aligning next to each other. However, the dropdown menus now overlap each other and both drop below the "About Us" section instead of below their respective buttons.
You can view a screenshot of my site for reference.
#headbar {
width: 100%;
position: fixed;
top: 0;
left: 0;
right: 0;
height: 50px;
z-index: 2;
border: 2px black solid;
display: inline;
background-color: #ff0000;
}
#logo {
display: inline;
height: 50px;
width: 50px;
border: none;
}
#title {
display: inline;
text-align: center;
font-size: 20px;
min-width: 100%;
border: 2px solid black;
}
.button-container {
display: flex;
left: 190px;
min-width: 100%;
min-height: 50px;
border: 2px solid black;
top: 0;
position: absolute;
}
#button-1 {
background-color: red;
color: white;
padding: 15px 10px 15px 10px;
font-size: 15px;
text-align: center;
font-weight: bold;
display: inline;
border: none;
border: 2px solid black;
height: 50px;
width: 100px;
position: relative;
}
#button-2 {
background-color: red;
color: white;
padding: 15px;
font-size: 15px;
text-align: center;
font-weight: bold;
display: inline;
border: none;
border: 2px solid black;
height: 50px;
width: 100px;
position: relative;
left: 100px;
}
.dropdown {
position: absolute;
display: inline-block;
}
.dropdown-content a {
color: white;
padding: 8px 10px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {
background-color: #ff0000;
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #ff0000;
}
<nav id="navbar">
<header id="headbar">
<h1 id="title">DAILY</h1><img id="logo" src="https://i.ibb.co/C7wkQsw/DB-Logo.png" alt="Daily Bugle Logo"><h1 id="title">BUGLE</h1>
<div class="button-container">
<div class="dropdown">
<button class="dropbtn" id="button-1">About Us</button>
<div class="dropdown-content">
<a class="nav-link" href="#Section_1">What We Are</a>
<a class="nav-link" href="#Section_2">Journalist Oath</a>
<a class="nav-link" href="#Section_3">Editors</a>
<a class="nav-link" href="#Section_4">Writers</a>
<a class="nav-link" href="#Section_5">Photographers</a>
</div>
</div>
</div>
<div class="button-container">
<div class="dropdown">
<button class="dropbtn" id="button-2">Politics</button>
<div class="dropdown-content">
<a class="nav-link" href="#Section_1">Super-Politics</a>
<a class="nav-link" href="#Section_2">Local</a>
<a class="nav-link" href="#Section_3">United States</a>
<a class="nav-link" href="#Section_4">Global</a>
<a class="nav-link" href="#Section_5">Galactic</a>
</div>
</div>
</div>
</header>
</nav>
Despite spending two hours working on this, my memory is not the best, so I can't recall everything I've tried. I'm unsure what steps to take next to resolve this issue.