CSS navigation menu with drop-down functionality

I am currently learning CSS and HTML as I work on the CCTCcart project. When running the code in the bottom menu section, I noticed that when clicking on any menu item such as Products, the white background color merges with blue. I need to find a solution to this issue.

HTML

<!doctype html>
    <html>

    <head>
    <meta charset="utf-8">
    <title>Welcome to Cctvcart store</title>
    <link rel="stylesheet" href="css/style.css" type="text/css">
    </head>

    <body>

     <div class="header_wrap">
      <div class="header_top_wrap">
      <div class="header_top">
      </div>
     </div>
     <!--end of header top wrap -->
      <div class="header_bottom_wrap">
       <div class="header_bottom">
        <ul class="bottom_menu">
          <li><a href="#">Company</a>



           </li>
           <li><a href="#">Products</a>
            <u1 class="submenu">
              <li><a href="#">DVR & Kits</a>
              </li>
              <li><a href="#">spy camraes</a>
              </li>
              <li><a href="#">alarms</a>
              </li>
            </u1>
           </li>

           <li><a href="#">Services</a>
           </li>
           <li><a href="#">Support</a>
          </li>
          <li><a href="#">Multimedia</a>
          </li>
         </ul>




         </div>
         </div>
         <!--end of bottom  wrap -->
         </div>
          <!--end of header wrap -->
          <div class="main_wrap">
          <div class="main">
          </div>
          <!--end of main  -->
          </div>
           <!--end of main wrap -->
           <div class="footer_wrap">
           <footer></footer>
            </div>
           <!--end of footer wrap -->
           </body>

            </html>

CSS

* {
   margin: 0px;
   padding: 0px;
 }




 .header_wrap {
   width: 100%;
   height: 160px;
   background: red;
   position: relative;
 }




.main_wrap {
   width: 100%;
   height: 1475px;
   background: green;
 }




 .footer_wrap {
   width: 100%;
   height: 325px;
   background: aqua;
 }




 .main {
   width: 1000px;
   height: 100%;
   background: blue;
   margin: auto;
 }




 footer {
   width: 1000px;
   height: 100%;
   background: aqua;
   margin: auto;
 }




 .header_top_wrap {
   width: 100%;
   height: 23px;
   background: #ccc;
 }




 .header_bottom_wrap {
   width: 100%;
   height: 40px;
   background: #06F;
   position: absolute;
   bottom: 0px;
   left: 0px;
 }




 .header_top {
    width: 1000px;
   height: 100%;
   background: purple;
   margin: auto;
 }




 .header_bottom {
   width: 1000px;
   height: 100%;
   background: black;
   margin: auto;
 }

 .bottom_menu > li {
   display: inline-block;
 }




 .bottom_menu a
 {
     font-family: Impact, Haettenschweiler, "Franklin Gothic Bold", "Arial Black", sans-serif;
     color: #fff;

 }




 .bottom_menu > li >a {
   display: block;
   text-decoration: none;


   padding: 0px 30px;
   height: 45px;
   line-height: 35px;
   text-align: center;
 }




.bottom_menu > li:hover >a
{
    background:#fff;
    color:#151716;
}




.submenu  a:active, .submenu  a:visited{
  display: block;
  color: #fff;
  text-decoration: none;
  z-index: 21;
}




.submenu {
  position: absolute;
  display: none;
  width:160px;
  height:250px;
  background:white;
  list-style:none;
}




.dropdown:hover > .submenu{
  display: block;

}




.submenu>li>a
{
    display:block;
    width:100%;
    height:42px;
    background:black;
    text-decoration:none;
    line-height:58px;
    padding-left:50px;
    border:1px dashed white;
}

Answer №1

Make the following changes to your CSS:

.footer_menu > li >a {
    display: inline-block;
    text-decoration: none;
    padding: 0px 20px;
    height: 50px; /* here's the element that needs adjustment */
    line-height: 45px;
    text-align: center;
}

Answer №2

I trust this will be of assistance to you.

Visit the following link for more details

HTML

<form id="form1" runat="server">
    <div>
        <br />
        <br />
        <div style="text-align: center;">
            <label class="button">
                <input type="radio" name="button" />
<span class="outer"><span class="inner"></span></span><span class="text">Include Additional Information</span></label>
            <label class="button">
                <input type="radio" name="button" /> <span class="outer"><span class="inner"></span></span><span class="text">Option 2</span></label>
            <br />
            <br />
            <br />
            <br />
        </div>
        <br />
    </div>
</form>

CSS

.button {
    background: #cfe7fa;
    background: -moz-linear-gradient(top, #cfe7fa 0%, #6393c1 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #cfe7fa), color-stop(100%, #6393c1));
    background: -webkit-linear-gradient(top, #cfe7fa 0%, #6393c1 100%);
    background: -o-linear-gradient(top, #cfe7fa 0%, #6393c1 100%);
    background: -ms-linear-gradient(top, #cfe7fa 0%, #6393c1 100%);
    background: linear-gradient(top, #cfe7fa 0%, #6393c1 100%);
    border: 1px solid #6393c1;
    -moz-border-radius: 20px;
    -webkit-border-radius: 20px;
    border-radius: 20px;
    -moz-box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5), inset -1px -1px 0 rgba(0, 0, 0, .5);
    -webkit-box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5), inset -1px -1px 0 rgba(0, 0, 0, .5);
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5), inset -1px -1px 0 rgba(0, 0, 0, .5);
    cursor: pointer;
    display: inline-block;
    font: 10px Arial, Verdana, Geneva, sans-serif;
    line-height: 3px;
    padding-right: 5px;
}
.button:hover .inner {
    opacity:.5;
}
.button input {
    display:none;
}
.button input:checked + .outer .inner {
    opacity:1;
}
.button .outer {
    background:#2989d8;
    background:-moz-radial-gradient(center, ellipse cover, #2989d8 0%, #101354 99%);
    background:-webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #2989d8), color-stop(99%, #101354));
    background:-webkit-radial-gradient(center, ellipse cover, #2989d8 0%, #101354 99%);
    background:-o-radial-gradient(center, ellipse cover, #2989d8 0%, #101354 99%);
    background:-ms-radial-gradient(center, ellipse cover, #2989d8 0%, #101354 99%);
    background:radial-gradient(center, ellipse cover, #2989d8 0%, #101354 99%);
    border:1px solid black;
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    border-radius:10px;
    height:10px;
    margin:5px;
    width:10px;
}
.button .inner {
    background:#e4f5fc;
    background:-moz-radial-gradient(center, ellipse cover, #e4f5fc 0%, #bfe8f9 50%, #9fd8ef 51%, #2ab0ed 100%);
    background:-webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #e4f5fc), color-stop(50%, #bfe8f9), color-stop(51%, #9fd8ef), color-stop(100%, #2ab0ed));
    background:-webkit-radial-gradient(center, ellipse cover, #e4f5fc 0%, #bfe8f9 50%, #9fd8ef 51%, #2ab0ed 100%);
    background:-o-radial-gradient(center, ellipse cover, #e4f5fc 0%, #bfe8f9 50%, #9fd8ef 51%, #2ab0ed 100%);
    background:-ms-radial-gradient(center, ellipse cover, #e4f5fc 0%, #bfe8f9 50%, #9fd8ef 51%, #2ab0ed 100%);
    background:radial-gradient(center, ellipse cover, #e4f5fc 0%, #bfe8f9 50%, #9fd8ef 51%, #2ab0ed 100%);
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    border-radius:10px;
    display:block;
    height:10px;
    margin:.5px;
    opacity:0;
    -moz-transition:opacity .5s;
    -webkit-transition:opacity .5s;
    -o-transition:opacity .5s;
    transition:opacity .5s;
    width:10px;
}

span.text,
span.outer
{
    display: inline-block;
    vertical-align: middle;
}

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

Leveraging a combination of AngularJS directives within a single div element

Why can't I use multiple directives in the same div tag in AngularJS? The product names from the module are not displayed with the following HTML code: <!DOCTYPE html> <html ng-app="gemStore"> <head> <title></ti ...

What steps should I take to modify my database while utilizing radio buttons in the edit mode?

I am experiencing an issue with the radio button functionality. When creating a new user.jsp, I am able to successfully add the value from the radio button to the database. However, when I attempt to edit the values in the jsp, the changes do not reflect i ...

The styling for material UI's default endAdornment is lacking accuracy

My Autocomplete component from material UI v5 includes a default endAdornment icon. However, the icon appears to have the CSS property top:unset, causing it to be styled incorrectly. Here is the code for rendering the Autocomplete: <Grid item xs={3}> ...

Grid system that adapts without distortion

My goal is to create a grid that maximizes the number of elements in its width without stretching them to fit the entire window. That's why I'm utilizing CSS grid with the auto-fill property, which is almost achieving the desired outcome. I want ...

Issue with collapsed navbar button functionality in Bootstrap version 5.1.3

Issue with Bootstrap 5 Navbar Collapse Functionality The navbar collapse button is not working on my PC. The button appears but when clicked, the navbar does not show up. Surprisingly, when I test the code on Codeply (without linking to Bootstrap 5 and ot ...

The Bootstrap collapsible feature is causing elements to shift to the adjacent column

I'm currently implementing bootstrap's collapsible feature to showcase a list of stores along with expandable details. However, the issue arises when I expand one of the collapsibles in the left column, causing certain items to shift into the ne ...

Injecting navigation bar onto an HTML page using jQuery

After being a dedicated user of ASP, I have made the decision to switch to a Linux-based server for my website. However, as I begin to build my site, I am facing challenges that were once simple in ASP - such as loading a constant navigation bar. My objec ...

What is the best way to implement a modal that can toggle dark mode using the Konami code, with the added functionality of a close button?

Recently, I attempted to create a Modal window that would activate when the Konami code (↑↑↓↓←→←→BA) is typed. As someone new to JavaScript, I'm still learning and open to feedback. While I have the coding part figured out, I need assi ...

Exploring how to extract table data using XPath in PHP through continuous loops

Here is an example of the HTML code for a table: <tbody> <tr>..</tr> <tr> <td class="tbl_black_n_1">1</td> <td class="tbl_black_n_1" nowrap="" align="center">23/07/14 08:10</td> <td ...

Adjust the div height to 100% in Bootstrap to center text, even with the presence of a navbar

I'm currently using Bootstrap 5 and facing an issue with getting text centered vertically on the page. I attempted to make the container of the div take up 100% of the page by using h-100, but it resulted in overflow due to the navbar occupying some s ...

Any ideas on how to fix the error that pops up during the installation of the bootstrap package in Node

The npm command is not recognized as a valid cmdlet, function, script file, or operable program. Please double check the spelling of the command and ensure that the path is correct before trying again. This error occurred at line 1. npm i bootstrap + ...

What is the best way to extract a JSON value and use it across multiple functions?

Currently, everything seems to be working fine. However, I'm unsure about the correct way to call the json data. I attempted using a direct link but it didn't work. Do I need to modify the "data" parameters? I'm confused because I saw that ...

MTG Life counter. Display fluctuations in count

I am currently working on a fun project creating an MTG (Magic The Gathering) life tracker, even though the code is quite messy. Despite its flaws, it still gets the job done. Click here to view the MTG life tracker https://i.stack.imgur.com/Su17J.png ...

When using angular.less, the @import feature is functioning correctly but a 404 error is displayed in the

Currently, I am working on a project using AngularJS along with angular.less. To centralize all my constants, I have stored them in one .less file and imported it at the beginning of all my other less files using a relative path: @import "constants" Even ...

Ways to utilize the ::after pseudo class with ElementRef within Angular

Is it possible to manipulate the background-color of the ::after pseudo selector for the specified element using Angular? @ViewChild('infobubble', { read: ElementRef }) infoBubbleElement: ElementRef; ngAfterViewInit(): void { const el ...

Modify the background color of four results with the help of PHP

With php, I am looking to dynamically change the background color of a td based on the number within it. While this can be achieved using CSS by assigning different classes to each td with specific colors, I prefer a more straightforward method for mainten ...

Manually adjusting the aria-expanded attribute to "true" does not result in opening a new tab

After a certain condition is met, I want to open another tab. Below is my bootstrap navbar code along with the jQuery script. <ul class="nav navbar-default nav-justified" role="tablist" id="navbar"> <li role="presentation" class="active"><a ...

Is it not possible to collapse in webkit?

Check out this jsfiddle link for a visual example: http://jsfiddle.net/qrbhb/ If you use the following HTML markup: <div>There should be no gap between us</div> <br /> <div>There should be no gap between us</div> along with ...

The daterangepicker reigns supreme above all other elements

Just a heads up, I am utilizing daterangepicker from this link: . Recently, I encountered an issue where the input field was overlapping with other elements like bootstrap Modals or menus. <div class="col-md-3 form-group"> <div class=&qu ...

Identifying page elements in Protractor when they lack obvious identifiable properties

Scenario Here is the HTML code snippet using an Angular JS template: <div class="data-handler-container"> <div class="row"> <div class="data-handler" ng-if="dataController.showDistance()"> <p>{{ 'Item ...