How can i target sub-menu class help please

Discussion in 'CSS' started by macaela, Mar 16, 2012.

  1. #1
    Hi i have the following html code produced by wordpress menu now i am trying to style the whole ul sub-menu but i cant seem to be able to target that sub-menu ul can someone help out please

    I have tried like this but didnt work
    #menu-left-side-menu li.current-menu-item ul.sub-menu { background-color:red;}
    HTML:
    i also tried just
    .sub-menu {  background-color:red;}
    HTML:
    here the html menu
    <ul class="menu" id="menu-left-side-menu">
        <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-82 dcjq-parent-li" id="menu-item-82"><a href="/about-us/" class="dcjq-parent">About us<span class="dcjq-icon"></span> <span class="dcjq-count">(1)</span></a>
            <ul class="sub-menu" style="display: none;">
                <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-114" id="menu-item-114"><a href="about-us/company-history/">Company History</a>
                </li>
            </ul>
        </li>
    </ul>
    HTML:

     
    macaela, Mar 16, 2012 IP
  2. bigmac

    bigmac Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    do you have the site it would be more use to me? can pm if need be

    Also need know what exactly you want to style is it the sidebar for example you want a new color?

    without seeing the site looks like you need a div or a span around the whole UL area as UL doesnt work to create a colored box like your trying achieve.
     
    bigmac, Mar 16, 2012 IP
  3. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    Hi this si the site
    http://themoneymap.zealcreate.co.uk/our-services/

    if you look on the left side is the menu what i want to do is to put a whole background on the sub menu when it visible if you click on the menu title the submenu will display i want to be css a background on the ul.submenu
     
    macaela, Mar 16, 2012 IP
  4. bigmac

    bigmac Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    #category_content_left li a {
    background-color: red;
    color: #FFFFFF;
    display: block;
    float: left;
    font-weight: bold;
    height: 31px;
    padding-top: 10px;
    text-decoration: none;
    width: 185px;
    }

    That allows them to be highlighted red signular boxes

    thats already in your styles.css just add the background-color:red to it

    If you want to create a box around them completely that will be red you will need to add a div or span around the sub menu ul
     
    bigmac, Mar 16, 2012 IP
  5. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #5
    no thats not the style for the menu thats a different menu which is on the home page.
    I want to target the sub-menu if you have firefox inspect element on the menu u should be able to see the div class sub-menu thats what i want to style.
     
    macaela, Mar 16, 2012 IP
  6. bigmac

    bigmac Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    that is a part of the sub menu? its the inner of the sub menu

    when you click "our services" for example the menu drops down

    with the code i just give you each one would have a red box around it

    If you want a solid box around it all you need add a div
     
    bigmac, Mar 16, 2012 IP
  7. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #7
    yes you right but there is a sub menu can i not just target the sub-menu class like #category_content_left ul.sub-menu { background:red} i cant add divs because the menu is creating trough wordpress isnt there a way to just style ul sub-menu
     
    macaela, Mar 16, 2012 IP
  8. bigmac

    bigmac Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Nope because its attached to a UL they dont work for background colors you need to add the div

    The div will in sidebar.php probably

    just add a div around it with a id and then color that
     
    bigmac, Mar 16, 2012 IP
  9. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #9
    Hi yes you can if you see here i've set different background for menu and different for teh sub-menu.
    The reason i cant do the same on mine is cz the wordpress has to many classes and sub classes and i cant find make the right sintax to pick teh sub-menu like this one
    <html>
    <head>
    <style type="text/css">
    ul.menu { background-color:red;}
    ul.submenu { background-color:blue;}
    </style>
    </head>
    
    <body>
    
    <ul class="menu">
        <li>one </li>
        <li>two
        <ul class="submenu">
             <li>one submenu </li>
             <li>one submenu </li>
        </ul> 
    
     </li>
    </ul>
    </body>
    </html>
    HTML:
    In teh meantime i will try to see if i cn do it by changing the sidebar.php so far cnat find anything on the sidebar but i will kee looking
     
    macaela, Mar 16, 2012 IP
  10. bigmac

    bigmac Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Id have to look internal and do it for ya
     
    bigmac, Mar 16, 2012 IP
  11. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #11
    you mean the css or the sidebar.php there is nothing on the sidebar.php I am not using sidebar.php is just a menu from wordpress this how i called the menu

    <div id="category_content_left"> 	<!-- START LEFT side CONTENT -->
            <?php   echo do_shortcode('[dcwp-jquery-accordion menu="Left-Side-Menu"  hover="100" animation="slow" auto_close="true"  save="true" disable="false" count="true" expand="true"]'); ?>
    	</div>
    PHP:
     
    macaela, Mar 16, 2012 IP
  12. bigmac

    bigmac Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    cant really say how the theme is setup one of the disadvantages of php you cant see whats going on under the hood how its setup

    it will be somewhere tho :S
     
    bigmac, Mar 16, 2012 IP
  13. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #13
    Thanks for the help u really think there is no way to grab that sub-menu class and styled it. i'll keep trying thanks for the help once again
     
    macaela, Mar 16, 2012 IP