What is the best way to incorporate background colors into the sidebar menus of grandchildren?

I am currently utilizing the advanced sidebar menus page which can be accessed through this link:

https://wordpress.org/plugins/advanced-sidebar-menu/

Within the plugin, there are widgets that allow users to add background colors and text colors to child menus.

However, one limitation we have encountered is the inability to add background colors to grandchild menus.

In the following code snippet, we successfully added a background color to the child menu named Purchasing.

Our challenge now lies in figuring out how to add background colors to the grandchild menus Online Content and Hot Items.

If anyone has a solution or workaround for this issue, please share your insights.

We prefer not to make changes directly to the original code as updates to the plugin could potentially overwrite our modifications.

The sample code below showcases the classes used for the sidebar menus:

<div id="advanced_sidebar_menu-8-wrap" data-js="advanced_sidebar_menu-8-wrap">
   <ul class="child-sidebar-menu">
      <li class="page_item page-item-2867 page_item_has_children current_page_item has_children"><a href="http://departments/?page_id=2867">Purchasing</a>
        <ul class="children">
            [Menu items within Purchasing menu]
       </ul>

       <li class="page_item page-item-5125 page_item_has_children has_children"><a href="#">Online Content</a>
           [Submenu items within Online Content menu]

       </li>

       <li class="page_item page-item-5123 page_item_has_children has_children"><a href="#">Hot Items</a>
          [Submenu items within Hot Items menu]
           
        </li>
       
     </ul><!-- End .child-sidebar-menu -->
  </div>

Here is our attempt at styling the menu items so far:

#advanced_sidebar_menu-8-wrap .child-sidebar-menu .page_item.page-item-2867 .page_item_has_children.current_page_item.has_children .children .page_item.page-item-5125 .page_item_has_children.has_children li a {
    background-color: #009B32 !important;
}

Answer №1

I believe this will be sufficient.

#advanced_sidebar_menu-8-wrap .page_item.has_children .page_item.has_children > a {
  background-color: #035;
}
<div id="advanced_sidebar_menu-8-wrap" data-js="advanced_sidebar_menu-8-wrap">
  <ul class="child-sidebar-menu">
    <li class="page_item page-item-2867 page_item_has_children current_page_item has_children"><a href="http://departments/?page_id=2867">Purchasing</a>
      <ul class="children">
        <li class="page_item page-item-5125 page_item_has_children has_children"><a href="http://departments/?page_id=5125">Online Content</a>
          <ul class="children">
            <li class="page_item page-item-2895"><a href="http://departments/?page_id=2895">division Descriptions</a></li>
            <li class="page_item page-item-2911"><a href="http://departments/?page_id=2911">Oracle</a></li>
            <li class="page_item page-item-2917"><a href="http://departments/?page_id=2917">Contracts</a></li>
            <li class="page_item page-item-5110"><a href="http://departments/wp-content/uploads/2018/10/2018.pdf" target="_blank">Certified</a></li>
            <li class="page_item page-item-2927"><a href="http://departments/?page_id=2927">Policies / Procedures</a></li>
            <li class="page_item page-item-2960"><a href="http://departments/?page_id=2960">Forms</a></li>
            <li class="page_item page-item-2936"><a href="http://departments/?page_id=2936">Special Notices</a></li>
            <li class="page_item page-item-2943"><a href="http://departments/?page_id=2943">FAQ</a></li>
            <li class="page_item page-item-5118"><a href="http://departments/?page_id=5118">Online Client Items</a></li>
          </ul>
        </li>
        <li class="page_item page-item-5123 page_item_has_children has_children"><a href="#">Hot Items</a>
          <ul class="children">
            <li class="page_item page-item-3460"><a href="http://departments/purchasing/pdf/PurchasingRestricted.pdf" target="_blank">Purchasing Restricted Item Policy</a></li>
            <li class="page_item page-item-5120"><a href="http://departments/purchasing/oracle_pdf/UpgradeAwareness.pdf" target="_blank">DeKalb 11.5.10.2 Upgrade Awareness Documentation</a></li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>
  <!-- End .child-sidebar-menu -->
</div>

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

Developing and integrating views within a node-webkit desktop application

For my file copier desktop application built with node webkit, I aim to create a seamless flow where the initial check for existing profile data determines the first page displayed. The header with static links/buttons to various views remains consistent ...

Styling <CardHeader> component with React and Material UI CSS

Incorporating React and Material UI, my goal is to arrange 3 divs within a <Card> <CardHeader/>, positioning them with left, center, and right alignment as illustrated below. The modification required is minor - I simply need to eliminate the ...

The combination of using p:inputText within p:layoutUnit does not function properly when placed inside p

Recently, I encountered a problem with a modal dialog that contains some input components. The issue arose when I implemented a p:layout within the dialog. Initially, the p:inputText component within a p:layoutUnit functioned properly and gained focus. Ho ...

Two divisions placed side by side

The current structure I am working with looks like this: <div id="container"> <div id="msg"><p>Lorem ipsum dolor sit amet.</p></div> <div id="img"><div id="content"></div></div> </div> # ...

Unable to place an absolutely positioned Div within relative parent containers

After applying the id "enterGame" with position: absolute, I noticed that the div disappears. Even when I tried adding position: relative to the body or html tag, the div remained invisible. The relevant code snippet is as follows: html { height: 10 ...

Overlapping Dropdown Javascript Menus

To achieve the desired effect in the header, I need to create two expandable dropdown menus for the first two titles. My coding experience is limited, especially when it comes to javascript and jquery. Currently, I have managed to create the effect for one ...

Initiate a fade-in/fade-out slider when the button is clicked

I have successfully developed a fadein/fadeout slider that automatically transitions between images. However, I am now looking to implement the functionality to manually play the slider by clicking on next/prev buttons. HTML <section class="wrapper"&g ...

Nest Bootstrap columns with rows aligned to the right

Trying to design a front page layout for a takeout restaurant. Encountering an issue where the last row doesn't align properly due to a double-height element. Here is the code snippet: <div class="row"> <a class="col-md-3 img-box img-h ...

What is the best method for overlaying text on individual images in a slideshow?

Currently, I am delving into the world of jQuery, experimenting with various slideshows and attempting to incorporate text and effects. In my endeavors, I stumbled upon this codepen that served as an excellent template. However, when I tried adding text o ...

What is the best way to use scrollIntoView() to display an additional item at the top or bottom of the visible area

When implementing scrollIntoView() with navigation buttons (up and down), I aim to display two items at a time to signal to the user that there are more items to navigate. However, the first and last items should retain their default behavior so the user u ...

"Designing with CSS: The Art of Styling

Recently, I came across a styling issue with a text area. After adding the following code to the view file of a Yii Application and the corresponding styling code to the CSS file, I noticed that the border of the text area remained unchanged when an error ...

Creating uniform height for Definition Terms (DT) and Definition Descriptions (

Looking to creatively style a description list <dl> in a way that showcases two columns, even when there are multiple <dd>s following the <dt>. The challenge lies in wanting this design to be dynamic without resorting to floating the < ...

Choose each day's time slot on the jQuery FullCalendar version 2.x

The code snippet below is a segment of the code generated by the FullCalendar jQuery plugin version 2. It has undergone some changes from version 1.x in terms of the classes it utilizes. <div class="fc-slats"> <table> <tbody> ...

Autofill functions may not be compatible with input fields generated using JavaScript

Having trouble with browsers not using autocomplete in login overlays generated with JavaScript? It can be really annoying. Any suggestions on how to fix this issue? Should I create a hidden form within the original HTML and then move it into the overlay? ...

I am interested in learning how to retrieve the page URL in order to trigger the opening of a menu in my sidenav bar

This is my navigation bar. I am trying to use JavaScript or jQuery to retrieve the current page's URL and open the corresponding dropdown container. I want to display the relevant section of the side navigation based on the URL. I have tried writing t ...

Adjusting the display property using the CSS plus symbol operator

I am currently in the process of designing a dropdown menu using CSS. The focus is on utilizing the following code snippet: #submenu_div { display: none; } #li_id:hover + #submenu_div { display: block; } UPDATE: Here is the corrected HTML structure ...

Tips for changing the width of a child element in CSS without impacting the parent's width

Here is the scenario: <div class="parent"> <div class="sizer" /> <div class="child" /> </div> .sizer { width: 200px; } .child { position: relative; width: 400px; } I am facing restrictions - I cannot explicitly set the width ...

Unable to override the Bootstrap theme

Despite trying multiple methods, I've found it challenging to override the CSS of Bootstrap specifically for this paragraph element P.fs-5.text-muted. Interestingly, all other CSS elements are easily modifiable. Here's an example that works: H1. ...

Display everything when an option is clicked

I have a filter that is working perfectly. When I select a specific category, it filters out only rows with that category. However, I am stuck on how to display all rows again after clicking on the first option. My objective is to show all rows when "Categ ...

Update the styling of buttons in CSS to feature a unique frame color other

Can anyone help me with styling Bootstrap buttons and removing the blue frame around them after they're clicked? Here's what I've tried: https://i.stack.imgur.com/jUD7J.png I've looked at various solutions online suggesting to use "ou ...