What steps should I take to create a submenu?

Visit this website for more information. Looking to add a new submenu in the Services section under Office 365 Consulting, we have completed the backend work and now need to style it using CSS to resemble a submenu. Attempts at giving padding or margin resulted in the submenu disappearing, only reappearing when adjusting the width of other submenus. We were able to achieve the desired look by setting position:fixed, but this caused synchronization issues with the backend and database.

                        <ul id="mainmenu">
                            <li><a href="/">Home</a></li>
                            <li><a href="/about">About</a></li>
                            <li><a href="#">Services</a>
                               
                                <ul>
                                    @foreach($services->sortBy('sort') as $service)
                                        <li>
                                            <a href="/services/{!!$service->seo_url!!}">{!!$service->title!!}</a>
                                            
                                            

                                            @if($service->id == $service->id)
                                                <ul> 
                                                    @foreach($subservices as $sub_service)
                                                        @if($sub_service->services_id == $service->id)
                                                            <li><a href="/services/subservices/{!!$sub_service->seo_url!!}">{!!$sub_service->name!!}</a></li>
                                                        @endif
                                                    @endforeach
                                                </ul>
                                            @endif

                                        
                                        </li>
                                    @endforeach
                               
                                </ul>
                            </li>
                            <li><a href="/news">News</a></li>
                            <li><a href="/price">Pricing</a></li>
                            <li><a href="/references">References</a></li>

                            <li><a href="/contact">Contact</a></li>
                            

                        </ul>
                        

This is how the HTML structure looks like.

#mainmenu {
    font-family: "Lexend";
    font-size: 14px;
    margin: 0 auto;
    float: none;
}

#mainmenu ul {
    margin: 0px 0px;
    padding: 0px;
    height: 30px;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    overflow: hidden;
    background: #ffffff;
    -webkit-box-shadow: 2px 2px 30px 0px rgba(20, 20, 20, 0.1);
    -moz-box-shadow: 2px 2px 30px 0px rgba(20, 20, 20, 0.1);
    box-shadow: 2px 2px 30px 0px rgba(20, 20, 20, 0.1);
}

#mainmenu li {
    margin: 0px 0px;
    padding: 0px 0px;
    float: left;
    display: inline;
    list-style: none;
    position: relative;
}

#mainmenu>li {
    letter-spacing: 1px;
    font-weight: 500;
}
...

These are some of the relevant classes used in styling the menu.

Answer №1

#mainmenu ul {
    margin: 0px 0px;
    padding: 0px;
    height: 30px;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    **//update - display: flex;**
    background: #ffffff;
    -webkit-box-shadow: 2px 2px 30px 0px rgba(20, 20, 20, 0.1);
    -moz-box-shadow: 2px 2px 30px 0px rgba(20, 20, 20, 0.1);
    box-shadow: 2px 2px 30px 0px rgba(20, 20, 20, 0.1);
}

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

unable to display images from a folder using v-for in Vue.js

Just getting started with Vuejs and I have two pictures stored on my website. The v-for loop is correctly populating the information inside databaseListItem. The path is /opt/lampp/htdocs/products_db/stored_images/cms.png https://i.stack.imgur.com/969U7.p ...

JavaScript accordions failing to open

I've encountered an issue with my website that includes JS accordions. Strangely, they are not opening on the live site, but they function properly on Codepen. I checked the console in Chrome and found no error messages, however, when I looked at the ...

Tips on restricting users to choose dates that are later than the current date

Currently, I am working with Vue3 using the options API. After reviewing this StackBlitz, my question is regarding how to correctly set the :max value for a date-picker. Even though I have assigned :max as new Date(), I am still able to select dates that ...

Is it possible to specify at what point the bootstrap dropdown should convert to a dropup instead?

I have noticed that the bootstrap 4 dropdown transitions to a dropup when there is not enough space at the bottom of the browser window. Is there a way to modify this behavior so that it changes to a dropup when it's, for example, 150px away from the ...

Encountering a CSS problem while attempting to design a section featuring a background image

On this page, I have the login bar on the right and the footer at the bottom. I want a div to sit in the area currently occupied by the background image and fill it with the full background image. Currently, everything is wrapped in a wrapper and the back ...

NodeJS - issues with nodemon auto-reload feature causing my server to not

After successfully installing NodeJS version 4.4.5, I proceeded to install nodemon version 1.9.2 by following all the installation instructions using npm (npm install -g nodemon). In a newly created folder, I have my server.js file with some basic code: ...

Handling JSON Data in JavaScript

In the script below, I have a json object that is being processed: $http({ url: '/mpdValidation/mpdValidate', method: "POST", data: { 'message' : mpdData } ).then(function(response) { console.log(response.data ...

Is it possible to dynamically alter the href attribute of a hyperlink within a Twig template in Symfony 2?

Developing a menu for my website has been occupying my time lately, sparking numerous inquiries about its functionality. Essentially, I aim to create a menu with a select option containing all my projects. By clicking on either the modify or delete button, ...

How can `localePath()` be utilized to create a dynamic route with Nuxt i18n?

I currently have this route set up in my i18n.config.js: { pages: { 'rental/_id': { nl: '/verhuur/:id', en: '/rental/:id', de: '/mietbestand/:id', }, } } When attempting to link to this page in my ...

Why is my Bootstrap 4 dropdown menu not appearing on the page?

I've been trying different codes, but no matter what I do, my Bootstrap dropdown menu isn't appearing. There is an arrow next to it, but nothing shows up when pressed. If anyone could point out what I did wrong in the code or what might be causin ...

Issue encountered when trying to integrate a CSS sticky footer with a liquid/fluid layout

I've been attempting to incorporate the CSS Sticky Footer technique demonstrated at cssstickyfooter.com. (I also experimented with Ryan Fait's solution without success). I believe I've followed all the instructions correctly. I have a conta ...

Bringing in PeerJs to the NextJs framework

Currently delving into NextJs and working on creating an audio chat application, I've hit a roadblock while attempting to import PeerJs. An error message keeps popping up saying 'window is not defined'. import Peer from 'peerjs'; ...

Utilizing the Array Object within a Callback Function

I am facing an issue with accessing data[i] in the callback function. Below is the code snippet: var data = ['Hello', 'World']; for(var i=0;i<data.length;i++){ console.log(data[i]); // This works perfectly // Using mysql to query ...

What is the best javascript framework to pair with twitter bootstrap?

After dabbling in twitter bootstrap, I discovered its impressive array of UI components. Interested in incorporating it into a project, my quest for a compatible javascript framework has left me torn between angularjs, backbonejs, and emberjs. Although I ...

AngularJS and adding to an array in the routing process

I'm currently working on creating a contact list with two different views. One view displays all the contacts and includes an option to add a new contact, which is represented by a button rather than a space to input information directly. The other vi ...

The input value linked with Vue is not displaying on the DOM

I am attempting to connect a property of an item within an array in the data object of Vue to the value attribute of an input tag using binding. However, when I inspect the DOM of a web browser, it does not display. <template v-for="role in roles"> ...

Issue with checkbox alignment in Twitter Bootstrap v3.x

Greetings fellow siblings. I am facing an issue with Twitter Bootstrap checkboxes, particularly when viewed in Opera, Chrome, and IE. Here is the problem: I have come across this snippet of code <div class="form-group"> ...

There was an error with the response code of 500 on the development server for react-native

An issue has been encountered on the node.js window: error: bundling failed: Error: Unable to resolve module react-native-gesture-handler from node_modules\@react-navigation\native\src\Scrollables.js: react-native-gesture-handler could ...

Are you looking to refresh the Amplify Redirect URL?

Is there a way to update the redirection URI for Amplify signout in the 'aws-exports' file? What steps should be taken to make this change? Can we simply modify the file directly and then execute 'amplify push'? Update After attempti ...

What is the best way to incorporate a changing variable within an htmx request?

One of the endpoints in my site requires an ID to be passed as a parameter. For example: mysite.com/product/{id}?limit=5 I'm wondering how to pass the 'id' variable in the hx-get attribute. I can utilize AlpineJS or vanilla JS for this tas ...