Missing Navigation Sub-Menu

I am encountering difficulties in making my SubNav appear when hovering over the "Shop" section. Despite borrowing some code from successful projects, nothing seems to be happening now. I am aiming for the menu to drop down and display other items in the SubNav on all pages of the site. Any recommendations would be greatly appreciated. Thank you!

/* Custom styles for the body */

body {
  font-family: 'Trocchi', serif;
  background-color: white;
  margin: 0px;
  width: 900px;
  margin: 0 auto;
  border: 3px solid #FEFA91;
}

h1,
h2,
h3,
p {
  margin: 0;
  padding: 0;
}

a {
  font-weight: bold;
  color: white;
}

a:link,
a:visited {
  color: black;
}

a:hover,
a:focus {
  color: #FEFA91;
}


/* Header Styles */

header {
  background-color: #FEFA91;
  width: 100%;
}

header img {
  display: block;
  margin-right: auto;
  margin-left: auto;
  padding-top: 5px;
}

/* Navigation Menu Styles */

#nav_menu {
  display: block;
  overflow: hidden;
  width: 100%;
  margin: 0;
  padding: 0;
}

#nav_menu ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  position: relative;
}

#nav_menu ul li {
  float: left;
  width: 25%;
}

... (remaining CSS styles)
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title>Ears To You Boutique - Holiday Ears</title>
  <link rel="shortcut icon" href="../images/tansp.png">
  <link rel="stylesheet" href="../styles/normalize.css">
  <link rel="stylesheet" href="../styles/ears.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Euphoria+Script">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Trocchi">
</head>

<body>
  <header>
    <a href="../index.html"><img src="../images/rsz_logo.png" alt="Logo" height="100" class="center"></a>
  </header>
  <nav id="nav_menu">
    <ul>
      <li><a href="../pages/about.html">About</a></li>
      <li><a href="../pages/shop.html">Shop</a>
        <ul>
          <li><a href="../pages/holidayears.html">Holiday</a></li>
          <li><a href="../pages/characterears.html">Character</a></li>
          <li><a href="../pages/eventears.html">Event</a></li>
        </ul>
      </li>
      <li><a href="../pages/gallery.html">Gallery</a></li>
      <li><a href="../pages/calendar.html">Calendar</a></li>
    </ul>
  </nav>
  ... (more HTML content)
</body>

</html>

Answer №1

#main_nav {
  display: block;
  overflow: hidden; //remove
  width: 100%;
  margin: 0;
  padding: 0;
}
#main_nav ul ul {
  display: none;
  position: absolute;
  top: 100%;
  width: 100%; // added
}

Answer №2

Utilizing the flexbox property, I arranged the main and right columns to align with the left on the same row within the section. For more in-depth information on using flexbox, check out this helpful guide.

section {
  display:flex; // Implement flex functionality
  width: 660px;
  margin: 0;
  padding: 11px 0 0 0;
}

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

The dropdown menu is being truncated

I am having an issue with a drop-down menu being cut off by its parent div. When I increase the height of the parent div, the drop-down menu becomes visible. Can someone please assist me? Below is my code snippet: MarkUp <div id="main-navigation" clas ...

Extracting data from a textbox in a PHP view and passing it to the controller

Is there a way to retrieve the values entered in a text box on a webpage and pass them to a PHP controller for display? VIEW <input type="text" name="Quantity" id="Quantity" value="" /> CONTROLLER function cartoutput() {//echo "hi"; $category ...

Send folder to the homepage of the website

I want to implement a redirect using .htaccess to prevent people from snooping into my directories and index files. For instance, if someone tries to access a specific image file like site.com/pics/1.jpg by trying to see the entire "pics" folder at site.co ...

Evolutionary JavaScript Adaptations

I am currently working on an HTML project that involves the use of JavaScript with JQuery. In my project, I will be including a map showcasing different images such as 'Abstract', 'Animals', 'Beach' and more. var images = { & ...

Material UI button component does not have the applied class

I'm encountering an issue with applying a CSS class (redirectButton) to a Material UI button. Despite my efforts, the class is not being successfully applied. Below is the HTML code in question: {(isDataAdapterAdmin && !dataSources?.length) & ...

Positioning elements within a Bootstrap column: Fixed versus Absolute positioning

Striving to maintain the absolute positioning of the right column as users scroll through the left column has proven to be a challenging task. Despite exploring various solutions from stackoverflow and google, none seem to effectively address this issue. ...

Generating alternate list items

I'm attempting to design a list style that resembles the one depicted in the image linked below: https://i.stack.imgur.com/U7vMw.jpg My issue is that when I try to add borders, they end up applying to the entire structure. .styled-list { list-st ...

HTML checkbox URL

Can you design an HTML checkbox form that generates a URL format like this: ?cat=cars+tree Currently, with the following code: <form name="input" action="/" method="post" > <br />Select Categories: <br /> <input type="checkbox" name ...

Rejuvenate your Bootstrap Accordion with these Settings

Using bootstrap documentation, I have implemented an accordion in my web application with the following code: <div class="accordion" id="accordion2"> <div class="accordion-group"> <div class="accordion-heading"> <a class=" ...

What is the best way to assign an image to a div using JavaScript or jQuery?

I'm attempting to create a notification box similar to this one: https://i.sstatic.net/HIJPJ.png As shown, there is a .gif image positioned at the top that will be hidden once the content loads. Now, I want to insert the following image into a <d ...

Creating websites with HTML and CSS

I am trying to enhance the style of my paragraph by applying multiple attributes, such as font color and font type, using CSS. While applying a single attribute like p {color:green} works fine, I encounter errors when trying to apply more than one line of ...

Issues arise with the functionality of a basic Vue.js script

I've attempted to execute the following code, which is supposedly the simplest example of Vue.js, but it doesn't seem to be working: <div id="app"> {{ message }} </div> <script> var app = new Vue({ el: '#app', d ...

Retrieve the accurate placeholder color using JavaScript

I modified the default placeholder color of my input to blue. How come I am seeing a black placeholder color when using JavaScript? const fetchPlaceholderColor = () => { let inputElement = document.querySelector('.myClass'); let inputEl ...

Modify the background color of a particular TD element when clicking a button using JavaScript and AJAX

When I click on the "Active account" button inside the designated td with the <tr id="tr_color" >, I want the value "1" to be added to the 'active_account' column in the database. I have been successful with this functionality. However, I a ...

What is the method to create a polygon in its entirety by utilizing a for loop within Javascript?

After successfully using the Canvas of HTML to draw a convex polygon, I encountered an issue. In the provided code snippet, t2 represents an array of points with getX() and getY() methods. The drawing function performs as expected until it reaches the seg ...

I am having trouble debugging the Twitter Bootstrap v4-alpha grid. The col-sm-offset-* class doesn't seem to be

Something has been altered somewhere, causing col-sm-offset-*s to stop functioning entirely. For instance, when attempting to split the screen in half and only display content on the right side, I typically would use: <div class="container"> < ...

What could be the reason my foreach loop is not being run?

After creating a login form that successfully grants access upon entering the correct email and password, there seems to be an issue. A foreach loop is implemented to test all results, with the assumption of only one account existing. foreach ($result as ...

Is there a way to add default text to a number input field that already has a value?

My current HTML input code is as follows: <input type="number" min="4" max="100" step="1" name="myInput" value="33"> The value of this input field is being populated from a cookie or storage that was set on a previous screen where the user provided ...

Incorporate ES6 module functions directly into HTML for seamless integration

I am grappling with a rather straightforward task: I have some code in a JavaScript module file that I import into another JavaScript file (which doesn't export anything), and my goal is to directly call certain functions defined in that file from the ...

Importing JSON data from a URL to display in an HTML table

Looking to utilize the Untappd API for a beer menu project, I've encountered an issue. The goal is to showcase the JSON data received from the server and organize it into an HTML table. Despite successfully importing data from a local list.json file ...