Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8938949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:44:20+00:00 2026-06-15T10:44:20+00:00

If the title is hard to understand, let me explain… I have a css

  • 0

If the title is hard to understand, let me explain…

I have a css / jquery toggle menu. When you press the “+” sign it gets bigger, when you press the “-” sign it gets smaller. I made the padding, margin and height of several elements change on toggle / click. The menu is full of links up top, then when you hover over the links it reveals more sub-links. The main links up top use the css code:

/*Top level menu link items style*/
.jquerycssmenu ul li a{
    display: block;
    background: none; /*background of tabs (default state)*/
    padding: 5px 18px 32px 18px;
    margin-right: 3px; /*spacing between tabs*/
    color:#fff;
    text-decoration: none;
}

The sub menus use this css code:

/* Sub level menu links style */
.jquerycssmenu ul li ul li a{
    font: normal 13px Verdana;
    width: 320px; /*width of sub menus*/
    height:60px;
    background: black;
    color: white;
    margin: 0;
    border-top-width: 0;
    border-bottom: 1px solid #2c2c2c;
    padding:20px 0px 0 20px;
}

I have set up the JQuery so sub menus padding shrinks via toggle… I did it like so:

$(document).ready(function(){   
  $('.gh-gallink').toggle(
    function() {
    $('.jquerycssmenu ul li ul li a').animate({
      height: "40px",
      padding: "10px 0px 0 20px"
    }, 100);
    $(this).text('+');
  },

  function() {
    $('.jquerycssmenu ul li ul li a').animate({
      height: "60px",
      padding: "20px 0px 0 20px"
    }, 100);
    $(this).text('-');

  });
});

This works perfectly fine! I then tried to enter in the JQuery for the main menus (.jquerycssmenu ul li a) I did it like so:

$(document).ready(function(){   
  $('.gh-gallink').toggle(
    function() {
    $('.jquerycssmenu ul li ul li a').animate({
      height: "40px",
      padding: "10px 0px 0 20px"
    }, 100);
    $('.jquerycssmenu ul li a').animate({
      paddingBottom: "8px"
    }, 100);
    $(this).text('+');
  },

  function() {
    $('.jquerycssmenu ul li ul li a').animate({
      height: "60px",
      padding: "20px 0px 0 20px"
    }, 100);
    $('.jquerycssmenu ul li a').animate({
      paddingBottom: "32px"
    }, 100);
    $(this).text('-');

  });
}); 

For some reason, the ul li a (main menu) effects the ul li ul li a (sub menu). As soon as you toggle the menu, the padding-bottom for the sub menus is the same for the main menu.. 32px when bigger and 8px when smaller.. when the padding-bottom should be 0px when bigger and 0px when smaller like listed above.

Why is ul li a (the main menu links) effecting ul li ul li a (the sub menu links)? And how can I fix this CSS / JQuery issue so that the main menu links doesn’t effect the sub menu links.

Just a quick note:
I can sucesfully edit the ul li a code without it affecting the ul li ul li a code.. in CSS. It’s just when I apply the codes to JQuery is when things mess up.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:44:21+00:00Added an answer on June 15, 2026 at 10:44 am

    You shoud use this:

    `.jquerycssmenu > ul > li > a`
    

    Instead of this:

    `.jquerycssmenu ul li a` 
    

    Here is an explanation of the > css selector:
    What does the ">" (greater-than sign) CSS selector mean?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's hard to put this into the title, so let me explain. I have
Sorry if my title is hard to understand. Let me explain. To use this
Hehe I'm having hard time on choosing the question title. But let me explain
Sorry if the title is hard to understand.. :S I have a table with
I guess the title is kind of hard to understand, so I'll explain. I
It's a bit hard to explain in a concise title what I'm asking, so
(I hope my title is comprehensible, it was hard to sum up.) I have
sorry for the confusing title, its really hard for me to explain what i
Sorry, the title is a bit hard to understand but I'm not 100% sure
Hard to put a descriptive title to this which is easy to understand so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.