Customizing the positioning of a dropdown menu to the right in WordPress

I've encountered an issue with the native dropdown menu in Wordpress. The menu is dropping elements on the left side, but I need them to appear on the right side. Below is the CSS code I'm currently using:

div#navigation { 
   float: left; 
   position: relative; 
   left: 50%; 
   margin-bottom: 35px; 
}
select.mobile_menu { display: none; }
div#navigation ul { 
   margin: 0; 
   padding: 0; 
   float: left; 
   position: relative; 
   left: -50%; 
}
div#navigation ul li { 
   float: left; 
   position: relative; 
   margin: 0px; 
   margin-left: 50px; 
   padding-top: 12px; 
   padding-bottom: 10px; 
   font-family: 'Vollkorn', 'Times New Roman', serif; 
}
div#navigation ul li:first-child { margin-left: 0px; }
div#navigation ul li ul.sub-menu { 
   display: none; 
   float: none; 
   position: absolute; 
   top: 50px; 
   z-index: 10000; 
   background: #F8F8F8; 
   border: 1px solid #CCC; 
   border-bottom: 0px; 
}
div#navigation ul li:hover ul.sub-menu { display: block; }
div#navigation ul li ul.sub-menu li { 
   position: relative; 
   float: none; 
   margin: 0px; 
   border-bottom: 1px solid #CCC; 
   font-size: 14px; 
}
div#navigation ul li ul.sub-menu li a { 
   display: block; 
   width: 200px; 
   height: 23px; 
   line-height: 23px; 
   text-align: center; 
}
div#navigation ul li ul.sub-menu li ul.sub-menu { 
   display: none; 
   position: absolute; 
   left: -202px; 
}
div#navigation ul li ul.sub-menu li:hover ul.sub-menu { 
   display: block; 
   top: -1px; 
}
div#navigation ul li ul.sub-menu li ul.sub-menu li ul.sub-menu { display: none; }
div#navigation ul li ul.sub-menu li ul.sub-menu li:hover ul.sub-menu { 
   display: block; 
   top: -1px; 
}

This is my personal website and the issue is visible in the screenshot. What changes should I make in the CSS to correct this problem?

Answer №1

After troubleshooting, I successfully resolved the issue by adjusting the left argument from -200px to 200px

div#navigation ul li ul.sub-menu li ul.sub-menu { display: none; position: absolute; left:200px;

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

Set the jQuery cookie to change the CSS property to hide the element

Currently, I am utilizing the jquery cookie plugin to make the browser remember the state of a CSS after refreshing the page. Below is an excerpt of my code where a button is clicked: $('#cartHolder').attr('style','display: no ...

What steps can be taken to implement CSS rules on an HTML element with ExtJS?

In my ExtJS 4 project, I am working on drawing an image inside a panel and slider field. My goal is to adjust the opacity of the image based on the value of the slider field. I understand that I can use CSS rules like opacity and filter:alpha(opacity=); t ...

Error: The selector "html" is not considered pure as it does not contain any local class or id. Pure selectors must include at least one local class or id

When working on my Next.js project, I included the following code in _app.js: import '../src/styles/style.module.scss'; import '../src/styles/main.module.scss'; This is the content of main.module.scss: // ./src/styles/main.module.scss ...

Is there a way to customize the hover effect on this navigation link in Bootstrap that includes a span and an icon from Bootstrap?

<li class="nav-item mt-3"> <a href="#" class="nav-link px-2 d-flex justify-content-start align-items-center"> <i class="nav-icon bi bi-calculator-fill fs-4"></i> ...

Incorporating Bootstrap content directories into ASP.NET website projects

I've been experimenting with Bootstrap for website design, but I'm facing an issue with adding files to my project. When creating a project in Visual Studio 2015 using File/New/Web Site..., I'm able to simply Copy/Paste the css, fonts, js fo ...

What are the steps to create a dynamic navigation menu in Angular 2?

I have successfully implemented this design using vanilla CSS and JS, but I am encountering challenges when trying to replicate it in Angular 2. Setting aside routing concerns, here is the current state of my component: navbar.component.ts import { Comp ...

What is the best way to replace a CSS Background that is already marked as important?

Attempting to change the background of a website using Stylish, but encountering issues. The existing background css on the website includes an !important rule which is preventing Stylish from taking effect. Here is my code: body { background-image: n ...

What is the reason for the index.html file not connecting to the local .css files and .js file?

I'm currently using node.js to send an .html file that includes the following tags: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="description" content="This is my personal profile website" /> <link r ...

The jQuery ellipsis extension is incompatible with the "max-height" property

Is it possible to use this plugin with the "max-height" css property? Currently, it only works with a specific height defined but not with max-height. Is there a way to make it compatible with max-height as well? (function($) { $.fn.ellipsis = f ...

The Bootstrap-Select dropdown refuses to open

I've been attempting to create a menu using data-subtext, and while I have come across some suggestions on stackoverflow, I'm still having trouble getting the menu to function properly. The issue I'm facing is that the menu doesn't seem ...

Determining the width of an element in terms of percentage

My issue involves input elements with widths set as percentages in CSS under the common class 'display-class' For example: input.test1 { width: 60% } In JavaScript, I am attempting to wrap a div around these input fields with the same width ...

Grid layout with Tailwind

I'm facing a challenge in my Angular project where I need to create a grid layout with 2 rows and 6 columns using Tailwind CSS. The actors array that I am iterating through contains 25 actors. My objective is to show the first 12 actors in 2 rows, fo ...

Swapping link positions with jQuery

Is it possible to rearrange links using jQuery? Under the navigation menu, there will be content div for each tab. The selected link should always be positioned next to the first "sixrevision" link. The code snippet is shown below: <ul id="crumbs" ...

Is there a way to use Css Autoprefixer on multiple files at once with a single function

My project built with Angular2 contains over 100 CSS files that do not have any prefixes for browsers like Mozilla or Chrome. I am looking for a tool, gulp task, or anything else that can automatically add prefixes to all of my CSS files. I attempted to u ...

Reset the text input field when the dropdown menu is set to 'no/other'

CURRENT: Choosing from a dropdown menu with options 'Yes' or 'No'. If 'Yes' is chosen: Display additional dropdowns/inputs for entry If 'No' is chosen: Conceal additional dropdowns/inputs WANT: I am looking to imp ...

Did the menu get shifted downwards on the mobile version by using bootstrap?

Here is the desktop version of a navigation bar. https://i.sstatic.net/e595L.png This image shows the mobile version after clicking on the hamburger button. https://i.sstatic.net/ng1tK.png I would like the menu to open when I click on the hamburger, bu ...

Step-by-step guide on utilizing jQuery to fade out all elements except the one that is selected

There are multiple li elements created in this way: echo '<ul>'; foreach ($test as $value){ echo '<li class="li_class">.$value['name'].</li>'; } echo '</ul>'; This code will generate the fol ...

Creating UL tabs using just HTML and CSSHere's a step-by-step guide

Looking for help to accomplish this task. I already have the styling, but I want something to happen when I click on the tabs. Specifically, I want the div with the tab class names to show and hide upon clicking the tabs. Currently, nothing happens when I ...

Is there a CSS fix for containing a floating div inside another div with overflow hidden?

I've managed to create a cool effect with a div of an airplane inside a parent div that has 'overflow: hidden' applied. This setup gives the illusion that the airplane div is flying from under an element on the page and carrying a banner alo ...

The images on the Shopify platform are becoming increasingly fuzzy

I'm facing an issue where the images I add to my Shopify site using the Brooklyn theme appear blurry unless resized to a small scale. The dimensions of the images are 1748 x 1240 at 300dpi. My intention is to implement a JQuery image slider (lightsli ...