My dropdown menu is not showing on top of the screen; it appears below the navigation section. I want to adjust it so that it appears above everything for better visibility. Here is my code snippet.
.sub-menu {
display: none;
margin-top: 0 !important;
}
.navbar-header .navbar-ul .main-menu-items .about-us-menu #about-sub-menu {
z-index: 100;
position: relative;
}
.navbar-header .navbar-ul .about-us-menu .sub-menu {
width:180px;
}
...
...</questionbody>
<exquestionbody>
<div class="question">
<p>My Dropdown menu opens up but it goes down under behind the screen like unless I increase the navbar height it isn't visible.
here is my code.
I want it to come on top of everything so the user can actually see it.
It goes underneath the nav section, so is not visible.</p>
<p><div>
<div>
<pre class="snippet-code-css lang-css"><code>.sub-menu {
display: none;
margin-top: 0 !important;
}
.navbar-header .navbar-ul .main-menu-items .about-us-menu #about-sub-menu {
z-index: 100;
position: relative;
}
.navbar-header .navbar-ul .about-us-menu .sub-menu {
width: 150px;
}
.navbar-header .navbar-ul .about-us-menu .sub-menu ul li a {
padding-top: 10px;
padding-left: 0;
padding-right: 0;
padding-bottom: 0;
}
.sub-menu ul li {
margin: 15px;
width: 120px;
position: relative;
/* padding: 15px; */
}
.navbar-header .navbar-ul .courses-sub-menu:hover .sub-menu ul li a {
width: 150px;
margin: 0 !important;
padding-top: 10px;
padding-left: 0;
padding-right: 0;
padding-bottom: 0;
}
.navbar-header .navbar-ul .about-us-menu .sub-menu {
width: 180px;
}
.navbar-header ul li:hover .sub-menu {
display: block !important;
position: absolute;
background: #333333;
margin-top: 15px;
}
.sub-menu ul:hover {
display: block !important;
}
.navbar-header ul li:hover .sub-menu ul {
display: block;
/* margin: 10px; */
}
.sub-menu ul li:hover {
display: block;
background: #f5f5f7;
color: black !important;
}
.sub-menu ul li a {
color: #f5f5f7;
}
.navbar-header ul li:hover .sub-menu ul li {
display: block !important;
color: black;
width: 150px;
padding: 0 !important;
border-radius: 0;
text-align: center;
}
.sub-menu ul li a:hover {
color: black;
}
<div class="navbar-header" style="padding: 0; margin: 0; ">
<ul class="navbar-ul">
<div class="main-menu-items">
<li>
<a routerLink="/home"><img src="../../../assets/xyz" class="navbar-logo" alt=""></a>
</li>
<!-- logo -->
<!-- <li><a routerLink="/home">Home</a></li> -->
<!-- <li><a routerLink="/aboutus">About Us</a></li> -->
<li class="about-us-menu"><a routerLink="#">About Us</a>
<div class="sub-menu">
<ul id="about-sub-menu">
<li>
<a href="/aboutus/gallery">Gallery</a>
</li>
<li>
<a href="/testimonials">Testimonials</a>
</li>
<li>
<a href="/blog">Blogs</a>
</li>
</ul>
</div>
</li>
<li class="courses-sub-menu"><a routerLink="/courses">Courses</a>
<div class="sub-menu">
<ul>
<li>
<a href="#">Science</a>
</li>
<li>
<a href="#">Physics</a>
</li>
<li>
<a href="#">Biology</a>
</li>
<li>
<a href="#">Mathematics</a>
</li>
<li>
<a href="#">Chemistry</a>
</li>
<li>
<a href="#">Business Studies</a>
</li>
<li>
<a href="#">Accountancy</a>
</li>
<li>
<a href="#">Economics</a>
</li>
<li>
<a href="#">Psychology</a>
</li>
<li>
<a href="#">SAT/ACT</a>
</li>
</ul>
</div>
</li>