Is there a way to position the secondary menu directly under the primary horizontal navbar?

I need help with positioning the secondary menu to drop down below the primary navbar item on hover. Currently, the menu is displaying above the list item and behind the adjacent list item, as well as being hidden behind content located beneath the navbar.

Here is the code snippet I have tried:

<%@ Master Language="C#" AutoEventWireup="true" 
        CodeBehind="Site2.master.cs" Inherits="abc.Site2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<!-- Head section -->

If you want to see what's happening, please refer to this image: https://i.sstatic.net/pjHjB.png

Can anyone advise me on how to fix this issue? Here is a reference image as well: https://i.sstatic.net/HRvYD.png

Answer №1

I just updated the styling for

`ul.nav#sec`

TO:

margin-left: -59px;
bottom: -4rem;
position: absolute;
z-index: 10;

ul {
list-style: none;
}

ul#pri.nav {
  margin-left: 0px;
  margin-top:50px;
  z-index: -1;
  border-top-right-radius: 15px;
  border-top-left-radius: 15px;
  text-decoration: none;
  width: 100%;
  background-color: rgb(180, 221, 180);

}

ul.nav {
  height: 10px;
}

ul.nav li {
  float: left;
  margin-top: 0px;
  padding: 10px 13px;
  font-family: Arial, sans-serif;
  font-size: small;
  line-height: 15px;
  cursor: pointer;
  font-weight: 700;
}

ul.nav#pri li {
  margin-top: 0px;
  float: left;
  margin-right: 5px;
  font-family: 'Arial Rounded MT';
  color: #fff;
  width: 100px;
  height: 6px;
  text-align: center;
  padding: 20px;
  display: block;
  -moz-border-radius-topleft: 15px;
  -webkit-border-top-left-radius: 15px;
  -moz-border-radius-topright: 15px;
  -webkit-border-top-right-radius: 15px;
  border-bottom-style: none;
  border-bottom-color: inherit;
  border-bottom-width: medium;
  background-color: #0fc15e;
  position: relative;
  bottom: 45px;
}

ul.nav#pri li a {
  text-decoration: none;
  color: #fff;
}

ul.nav#pri li.active,
ul.nav#pri li:hover ul.nav#sec {
  display: block;
  font-family: 'Arial Rounded MT';
  color: #a67cd5;
}

.nav#pri li:hover ul {
  color: #2b95b2;
}

ul.nav#sec {
display: none;
    margin-left: -59px;
    bottom: -4rem;
    position: absolute;
    z-index: 10;
}


ul.nav#sec li a {
  text-decoration: none;
  color: #fff;
  font-size: 14px;
}

ul.nav#sec li:hover {
  font-family: 'Arial Rounded MT';
  text-decoration: none;
  color: #fff;
  background-color: #747171;
}

      .auto-style2 {
        height: 550px;
      }

      .auto-style3 {
        height: 454px;
        margin-top: 40px;
      }

      .auto-style4 {
        height: 133px;
        margin-top: 81px;
      }

      .auto-style5 {
        margin-left: 57px;
      }

      .auto-style6 {
        width: 123px;
      }
    <form id="form1" runat="server" class="auto-style2">
      <div class="auto-style2">
        <div class="auto-style3">

          <div style="margin-top :80px">
            <div style="width:100%; float:left; margin-top: -20px;">
              <div style="float:left; width:44%; text-align:justify; margin-left:20px; 
   margin-top:-20px;">

                <asp:Image ID="Image1" Height="40" Width="150" ImageAlign="Middle" runat="server" ImageUrl="~/images/ Logo.png" />
              </div>
            </div>
          </div>
          <br />
          <br />

          <div>
            <ul id="pri" class="nav" style="height: 10px; margin-top: 30px">
              <li class="active"><a href="AfterLogin.aspx">Home</a></li>
              <li><a href="rubrics.aspx">Rubrics</a>
                              <ul id="sec" class="nav">
                  <li><a href="a">a</a></li>
                  <li><a href="b">b</a></li>
                  <li><a href="c">c</a></li>
                </ul>
              </li>
              <li><a href="CreateUser.aspx">Create User</a></li>
              <li><a href="#">Reports</a>
                <ul id="sec" class="nav">
                  <li><a href="a">a</a></li>
                  <li><a href="b">b</a></li>
                  <li><a href="c">c</a></li>
                </ul>
              </li>
              <li class="auto-style6"><a href="AdminMessaging.aspx">Messages</a></li>

              <li class="auto-style5">
                <asp:LinkButton runat="server" id="logout" onclick="logout_Click">Sign Out</asp:LinkButton>
              </li>
            </ul>

          </div>

          <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">


          </asp:ContentPlaceHolder>


        </div>
      </div>

    </form>
    <div id="p1" class="auto-style4">
      <div style="height:10px;"></div>

      <div style="color:#F5F5F5;text-align:center;">
        Copyright © xyz
      </div>
    </div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for preventing users from entering special characters into input fields

How can I prevent users from entering the # character into an HTML input field? I attempted to use the pattern attribute, but it does not seem to be effective. I included this pattern in my input element: pattern="[^-#]+" I expected that this would disa ...

What is the best way to ensure that a <div> extends all the way to the bottom?

My goal is to have this element reach the bottom of the screen, but I also have a header which complicates things. Setting height: 100%; or 100vh results in the page being too big and scrollable. I don't want to manually calculate it because of respon ...

Displaying a bootbox modal on top of another modal will not cause the modal in the background to appear dim

Currently, I am utilizing bootbox for my project and have encountered an issue. I have a button within my modal that, when clicked, should open another modal. However, the problem is that the background behind the two modals does not dim properly; instead, ...

Place the div at the center within the header

I'm struggling to center the logo in my media query for screens below 479px. Whenever I use margin auto, the image gets pushed to the right by the browser. Here is what I have so far and any assistance would be greatly appreciated. HTML <div clas ...

Managing asynchronous requests in ASP.NET Web API 2

Currently, I am investigating the potential outcomes when my Web API methods are simultaneously called by two clients. To achieve this, I am creating two asynchronous requests in Python: rs = (grequests.post(url, data = json), grequests.post(url, data = j ...

.htaccess keeps track of login information

Similar Query: HTTP authentication logout via PHP I have set up my website to protect a specific folder using .htaccess and .htpasswd. Initially, the login prompt works as expected and requires me to enter my credentials to access the protected conten ...

Finding content in HTML tables using JavaScript and jQuery

I recently created a table and wanted to add a search functionality to it. I searched online, including on various forums like StackOverflow, but unfortunately, the solutions I found did not seem to work for me. Below is the code that contains both the HT ...

Looking to develop a multi-tiered menu component?

I am currently using aurelia along with ES6 to develop a multi-level menu component. The JSON data structure that I'm working with looks like this: data: [ levelId: 1, label: 'Level1', childItems: [ { levelId: 2, labe ...

Showing Predefined Date on an HTML Form in an iOS Application

Is there a method to dynamically show the current date within the button that triggers the date picker in an HTML form on an iOS device? This is what currently appears: This is what I want it to automatically display: Below is the code I have implemente ...

Unable to display and conceal div elements

<ol class="novice"> <li> <p class="glava">HTML</p> <div class="vsebina"> <p>Hyper Text Markup Language (slovensko jezik za označevanje nadbesedila...</p> </div> </li> <li> ...

What is the best way to fetch and convert information from an API to display on a website?

I am encountering an issue while trying to retrieve data from an API. Below is my code with a fabricated access code. $(function () { var $data = ('#data'); $.ajax({ type: 'GET', url: 'http://api.openweathe ...

Deciding whether to use Device WebView Kit or HTML for your project is

I am a bit confused about creating a website for mobile devices. If I have a specific webpage in mind that I want to target towards mobile devices, do I need to use the native webview kits provided by iOS, or can I simply code in HTML, PHP, Javascript, an ...

Having trouble with my ajax code that reads a file into a div. I must be overlooking a small detail

Despite the simplicity of my task, I'm encountering an issue. Perhaps there is something crucial that I am overlooking. The objective is to retrieve the content of a text file using AJAX and display it within a div. While I can successfully write to ...

Struggling with creating adaptive cards in Bootstrap 4

After building a new website using Bootstrap 4, I encountered an issue with responsiveness. The layout consists of a fluid container with a Grid Row containing 8 columns, each filled with image cards. However, the cards do not display properly on different ...

Strategies for storing component data within an Angular service

Recently, I have implemented a dice game feature using Angular. The outcome of the dice rolls is stored in a TypeScript array and then displayed on the HTML page. However, I have been tasked with persisting these results even if I navigate to another pag ...

The background color of the div or section is stubbornly refusing to change, no matter how much I tweak it

.forBackground { background-color: white; } .kontaktUndMapContainer { width: 100%; padding: 20px; color: gray; text-align: center; } .überschriftKontakt { margin-bottom: 20px; } .überschriftKontakt2 { margin-top: 20px; margin-bottom: 2 ...

Issue with Navbar Header: Troubleshooting and Solutions

I'm having trouble with my navigation bar. I want to add "3" under the dropdown section and set up multiple menu items, such as Link 4. I couldn't figure out how to do this in my code... Could it be that Bootstrap doesn't support this feat ...

Converting Excel Files from ".xls" to ".xlsx" Using PHP

Currently, I am working on a PHP project which involves sending an email with an Excel attachment. To handle the email functionality, I am utilizing PHPMailer. However, I am encountering an issue with the format of the Excel file generated by the code belo ...

Missing elements on webpage when inspecting code

Today, I attempted to scrape data from this website , but surprisingly, I couldn't locate any of the actual page content in the HTML code visible in the inspector tool. It makes me wonder if they're using some kind of frame to conceal the code. ...

Alignment issue with content within bootstrap grid

.course-card{ background: white; border-radius: 0.25rem; padding: 1rem 1rem 1rem 1rem; text-align: center; } <div class="row d-flex align-items-center course-card"> <div class="col-md-6 course-progress"> <p>test</p> ...