Styling your website's navigation with CSS

I'm looking to create a navigation menu using HTML ul li that displays drop down items in a similar way to www.microsoft.com. For example, when you click on 'Products' on the Microsoft website, it shows a list of products in one dropdown window and a list of Entertainment in another column. How can I achieve this with CSS? Below is my current code:

<ul>
  <li>
    <a href="link" target="">Home</a>
  </li>
  <li>
    <a href="link" target="">Menu 1</a>
      <ul>
        <li>
           <a href="link" target="">Sub Menu 1</a>
             <ul>
               <li>
                 <a href="link" target="">sub Menu 1a </a>
               </li>

               <li>
             <a href="link" target="">sub Menu 1b </a>
               </li>

               <li>
              <a href="link" target="">sub Menu 1c </a>
               </li>
             </ul>
          </li>

        <li>
        <a href="link" target="">Sub Menu 2</a>
                 <ul>
                   <li>
                     <a href="link" target="">sub Menu 2a </a>
                   </li>

                   <li>
                 <a href="link" target="">sub Menu 2b </a>
                   </li>

                   <li>
                  <a href="link" target="">sub Menu 2c </a>
                   </li>
                 </ul>
          </li>

          <li>
            <a href="link" target="">Sub Menu 3</a>
                     <ul>
                       <li>
                         <a href="link" target="">sub Menu 3a </a>
                       </li>

                       <li>
                     <a href="link" target="">sub Menu 3b </a>
                       </li>

                       <li>
                      <a href="link" target="">sub Menu 3c </a>
                       </li>
                     </ul>
      </li>
     </ul>
     </li>
       <li> <a href="link" target="">Menu 2</a>   
         <ul> 
           <li> <a href="linl" > sub Menu 1 </a> </li>
           <li>  <a href="link2"> sub Menu 2 </a> </li>
         </ul> 
       </li>

     </ul>

When someone clicks on Menu 1 in my case, the Sub Menu 1 should display in a dropdown window with sub menu 1a, 1b, 1c below it. The same pattern should apply for other menu items as well, showing them in multiple columns if necessary. Does anyone have an example CSS to achieve this functionality?

Answer №1

There are numerous resources out there that showcase various CSS dropdown menu designs when you conduct a simple Google search.

An example of a popular option that many have relied on is found at the following link:

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

Duplicate multiple "li" elements using jQuery and place them in a designated position within the ul element, rather than at the end

I am currently working on developing a dynamic pagination bar. This pagination bar will dynamically clone the "li" elements based on a number received from an external webservice. Here is the structure of my pagination element: <ul class="pagination"& ...

Customizing CSS Styles Based on Browser Specifications

Attempting to utilize conditional stylesheets for targeting different versions of IE. Currently have the following setup: <!--[if IE 7]> <link href="_includes/css/ie7.css" rel="stylesheet> <![endif]--> <!--[if gte IE 7]> <link ...

Execute a refresh command on a JQuery function in order to update the selection picker

Below is the HTML code I have created to allow for multiple options to be selected with live search capabilities. My knowledge of jQuery is limited, but I have included a code snippet to refresh the selections if more than one option is chosen. < ...

The mat card doesn't quite align with the rest of the page

I am currently utilizing Angular Material and Bootstrap in my project. My aim is to display a mat-card that fits perfectly on all screen sizes. However, I am encountering empty spaces on the right side of the card. While it fits properly on some screen ...

What are some ways to improve the precision of longitude and latitude data?

I have encountered an issue while using MapBox. When a user clicks on the map, I am receiving longitude and latitude coordinates that are not very accurate. For example, when I clicked in the United Kingdom, the values pointed me to the middle of the sea a ...

Centering items in Bootstrap 4, while excluding the first element

.c-footer { background: #000; padding: 20px 0; color: #fff; } .c-footer__logo { display: inline; } .c-footer__link { color: inherit; } .c-footer__link a { color: inherit; } .c-footer__link a:hover { color: #fff; } ...

The button in the flex container is not wide enough due to center alignment

For my project, I implemented a CSS grid layout consisting of 20 rows and 20 columns (5% of screen for each cell). One particular page includes a button that initially fit within grid columns 5-8 and rows 6-9 without any issues. However, I wanted to center ...

What is the best way to showcase nested array information from a JSON file on an HTML webpage?

students.json { "students": [ { "studentname": "Rohit Kumar", "grade": "A", "student": [ { "SNo": "1", "Subject": "Maths", "Concept": "Numbers" }, { "SNo": "2", ...

Attempting to implement bootstrap pagination using PHP mysqli

Hi there, I'm currently working on implementing a pagination feature using Bootstrap. My goal is to display all results from mySQL data while limiting the data to 10 entries per page. I would appreciate any assistance with this. Here's the code I ...

Preserving modifications applied to the webpage through JavaScript

I am facing an issue with a webpage that has 2 tabs. The first tab includes a table with 'n' rows, each containing a text box. The values in other cells of each row are calculated using JavaScript based on the input in these text boxes. The pro ...

Learn how to change the icon in Vuejs when the class 'active' is present

I have a bottom navigation bar with icons. How can I make it so that when the router-link has the class 'active', the icon associated with it also becomes active? By default, the first icon is active. <li> <router-link v-if="ac ...

Expand Bootstrap navbar search box outside collapse menu

Currently, I am working on designing a navigation bar that showcases my brand on the left side, a full-width search bar in the center, and additional pages on the right. I am facing challenges in maintaining the full-width of the search bar without causing ...

Transitioning from one CSS id to another during page loading

Wondering how to fade in one CSS id on page load and then smoothly transition to another after a few seconds? Here are the ids: #background { background: url("images/am_photography_bg.jpg") no-repeat center -25px fixed; background-size: 100%; ...

Problem with Google's PageSpeed Insights - Focus on Making Most Important Content Visible

During the process of creating a comprehensive website for a client who has a strong affinity towards Google tools and recommendations, I have encountered an interesting challenge: Despite my best efforts, I seem unable to attain a flawless score for the ...

Challenges faced when using Selenium with Telerik RadMenu

For the past two days, I've been struggling to find an effective method for writing integration tests for my ASP.NET website using Selenium. The website features a Telerik RadMenu with a hierarchical structure like this: Root Menu - Menu 1 - Sub M ...

Launching Website with Google Chrome Extension

As I am relatively new to creating extensions, I decided to start with something simple. However, despite my initial belief that it would not be too difficult, I am struggling to make my extension open new tab pages in incognito mode and normal mode. POPU ...

The CSS perspective shape link is not functioning correctly

I'm attempting to create a trapezoid shape using CSS to contain a link, but it doesn't seem to be functioning correctly. I'm unsure if it's due to lack of support or if there's an issue with the code itself. It looks like it should ...

Are there any special CSS hacks that only work for IE8?

When it comes to Internet Explorer 8 (IE8), my preference is to utilize the following CSS: color : green; I am looking to implement a hack that exclusively impacts IE8, without affecting IE9, IE6, and 7. ...

Using jQuery.dataTables to choose all rows except the final column

I'm utilizing a table with jQuery.dataTables. I have a requirement to input dates in the last column. However, when I click to input a date, the row becomes deselected. The following code is meant for selecting all rows: Displayed below is the DataT ...

Numerous changes using media queries

Is there a way to have separate transitions in media queries without duplicating code? @media screen and (min-width: 800px) { #div { transition: width 1s; } } #div { transition: height 1s; /* Overrides previous one :( */ } How can I a ...