Guide on creating a drop-down effect on CSS menu when hovering

Similar Post:
html css drop down menu in navigation bar

I am trying to modify an existing horizontal menu to display vertical links when hovering over each category. How can I achieve this to make it function like a traditional dropdown menu?

Check out what I have done so far: http://jsfiddle.net/chaddly/GrEWS/3/

<ul id="nav">
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Services</a></li>
    <li><a href="#">Products</a></li>
    <li><a href="#">Sitemap</a></li>
    <li><a href="#">Help</a></li>
    <li><a href="#">Contact Us</a></li>
</ul>

#nav li a:hover 
{
   background-color:#333333;
   padding-bottom:12px;
   border-bottom:2px;
   border-bottom-color:#f37022;
   border-bottom-style:solid;
   margin:-1px;
}
#nav li a 
{   
   font-family:Arial;
   font-size:12px;
   text-decoration: none;
   float:left;
   padding:10px;
   background-color: #123261;
   color:#ffffff;
   border-bottom:1px;
   border-bottom-color:#000000;
   border-bottom-style:solid;
}
#nav li 
{
    display:inline;
}
#nav
{
    padding:0;
}

​Here is a sample of what I'm aiming for.

Answer №1

Check out the amazing features of the bootstrap dropdown menu!

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

Sending data through forms

I'm having trouble storing values input through a dropdown menu in variables event1 and event2, despite trying global declarations. How can I successfully store a value to both variables and pass it to the JavaScript code? Thank you. <!DOCTYPE HT ...

The div smoothly descended from the top of the page to the center under the control of jQuery

I am trying to implement a feature where a div slides down from the top of the page to the center when a button is clicked. However, my current code seems to be causing the div to slide from the bottom instead of the top. Ideally, I want the div to slide ...

Having trouble with the Javascript denial of submit functionality?

I'm dealing with an issue in my code where form submission is not being denied even when the input validation function returns false. I can't figure out what's causing this problem. <script> function validateName(x){ // Validati ...

Issues with IE9's CSS hover functionality are causing problems

This particular css style functions well on most browsers, but seems to have compatibility issues with Explorer 9 specifically when it comes to the :hover effect. There are instances where it works perfectly fine and other times when it doesn't work a ...

Having difficulty executing the overridden doPost method in a Java servlet

Included below is a snippet of code extracted from a jsp file. <table class="table table-striped table-hover table-responsive ezoo-datatable"> <thead> <tr> <th class="text-center">Schedule ID< ...

Issues with the CSS in our unique eBay template are creating some challenges

Our team is currently in the process of creating a customized template for our eBay listings. eBay provides users with the option to upload a description as HTML code and allows the code to link external CSS files. When uploading HTML code on eBay, it ap ...

Quiz timer using JavaScript

In my HTML and JavaScript project, I am creating a quiz game where players have 15 seconds to answer each question. To implement this timer feature, I used the following code snippet: <body onload="setTimeout(Timer,15000)"> Implemented in JavaScrip ...

Is there a method available to transform HTML information into Json format and extract the text data from the HTML?

I have some data that looks like this. { "key" : "key1", "items" : [ { "date":"2022-04-26" , "html":"<tr>\n<th scope=\"row\">\n<span class=\"ico_age age_12\">AAAAA<\/span><a ...

Angular mobile navbar experiencing collapse issue

I am working on an Angular project that does not include Jquery. I am trying to implement a navbar using mdbootstrap, but I am encountering issues with the collapse feature not working properly. Below is the HTML content I am using: <header> < ...

Using AngularJS filter to refine results based on specific values within JSON data

I am looking to implement a custom free text filter with just one input field in a table. The standard filter currently applies to all values, but I specifically need it to focus on col1 and col2 from this JSON array: myJsonArray = [{col1: "xxx", col2: "y ...

Comparing the features of Semantic-ui to bootstrap's forms-controls-static

Are there any similar classes in Semantic-UI to the forms-controls-static class in Bootstrap? This class allows plain text to be placed next to a form label within a form. You can find more information about this feature by visiting the following link: ht ...

Retrieve data from HTML Form arrays using JavaScript

I have a situation in my forms where arrays are being sent back in the following format: <input class="checkbox-service" name="services['electricity']" type="checkbox"> <input class="checkbox-service" name="services['water'] ...

When converting the .html file to a .php file, the CSS file fails to be linked correctly

The issue I'm facing seems to be specific to the index.html file. The CSS that functions properly with an html extension suddenly stops working when the extension is changed to php. Upon inspecting the reference link in both cases, I noticed that when ...

Tips for interpreting JSONP objects

After setting up this HTML file to send a GET request to the random word API (wordnik) server, I received a response that looked like this: [{"id":2998982,"word":"failproof"}] My goal is to extract the "word" part from the response, but I'm struggli ...

Utilizing multiple class names in Material UI with identical definitions

When working with traditional CSS, it is common to define shared properties between classes like this: .classA,.classB{ background-color: black; } In Material UI and using theming, the equivalent would be: styles = (theme)=>({ classA:{ ba ...

Utilizing Java in JSP to execute jQuery functionality through a hyperlink

Working on a project with my school group and encountering some difficulties... We have a table in which we are using JSP to populate with data through a for-loop. Each cell in the table represents an object utilizing JPA with its own unique id. In our ...

What is the most efficient way to write this code?

When I find myself surrounded by a ton of PHP code, instead of exiting PHP I tend to include variables directly within strings like this: echo "This is how I use a ".$variable." inside a string"; However, I wonder if it would be more efficient to actuall ...

Responsive design for iPad and larger screens - adjusting to different screen sizes

Does anyone know of a CSS code that can effectively target both iPad and desktop devices with a max-width of 768? I attempted the following code, however it seems to only work for desktops: @media only screen and (max-width: 768px) Due to this limitatio ...

Choosing JavaScript

<select> <script type="text/javascript"> $.get( 'http://www.ufilme.ro/api/load/maron_online/470', function(data){ var mydata = new Array(); var i = 0; // индекс масси ...

What is the best way to retrieve the innerHTML content from several Quill instances that share the same class identifier?

I have successfully implemented multiple Quill text editor instances on a single page. However, I am now facing a challenge in retrieving the innerHTML of each instance. When creating a single instance and assigning its innerHTML to a hidden input field, I ...