Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Dec 2008
    Location
    Ohio, USA
    Posts
    29
    Thanks
    4
    Thanked 0 Times in 0 Posts

    dropdown li background color

    Hi all,

    I'm working on a Wordpress website and have one navigation button on the home page with a dropdown menu. I want to change the color of the list items under 'artifacts'.
    Here's the code:

    Code:
    						<nav id="nav-top" class="left clear"><ul id="nav-top-desktop" class="hide-lte-mobile"><li id="menu-item-71" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-71"><a href="http://oldschoolfirealarms.com/">home</a></li>
    <li id="menu-item-72" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-72"><a href="http://oldschoolfirealarms.com/about/">about</a></li>
    <li id="menu-item-136" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-136"><a href="http://oldschoolfirealarms.com/pull-rod-fire-alarm-systems/">pull-rod fire alarms</a></li>
    <li id="menu-item-137" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-137"><a href="http://oldschoolfirealarms.com/old-schools/">old schools</a></li>
    <li id="menu-item-145" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-145"><a href="#">artifacts</a>
    <ul class="sub-menu">
    	<li id="menu-item-139" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-139"><a href="http://oldschoolfirealarms.com/trip-bells/">trip bells</a></li>
    	<li id="menu-item-140" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-140"><a href="http://oldschoolfirealarms.com/electric-bells-and-horns/">electric bells and horns</a></li>
    	<li id="menu-item-141" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-141"><a href="http://oldschoolfirealarms.com/pull-stations/">pull-stations</a></li>
    	<li id="menu-item-142" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-142"><a href="http://oldschoolfirealarms.com/control-panels/">control panels</a></li>
    	<li id="menu-item-143" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-143"><a href="http://oldschoolfirealarms.com/fire-alarm-signs/">fire alarm signs</a></li>
    </ul>
    </li>
    Any suggestions will be appreciated.

    Thanks.
    Last edited by droliff; 05-04-2014 at 01:34 PM.

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,166
    Thanks
    23
    Thanked 601 Times in 600 Posts
    <style type="text/css">
    .sub-menu a{
    color: red;
    }
    </style>
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #3
    New Coder
    Join Date
    Dec 2008
    Location
    Ohio, USA
    Posts
    29
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Hi sunfighter,

    Thanks for the input. What I'd really like to do is change the background color of each item in the dropdown menu to transparent so that you don't see the box, just the type.
    I tried this:
    <style type="text/css">
    .sub-menu a{
    background-color: transparent;
    }
    </style>
    but the background color stayed the same as the default as you see here (it even looks slightly gradated):



    I can change the background color to red or blue or any other color, just not transparent. Any suggestions?

    Thanks.

  • #4
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,166
    Thanks
    23
    Thanked 601 Times in 600 Posts
    background-color: transparent; is not correct opacity is the property needed.
    ex:
    <style type="text/css">
    .sub-menu a{
    background-color: #ffffff;
    opacity:0.6;
    filter:alpha(opacity=60); /* For IE8 and earlier */
    }
    </style> You can add all other properties for the dropdown here also.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #5
    New Coder
    Join Date
    Dec 2008
    Location
    Ohio, USA
    Posts
    29
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Hi sunfighter,

    Thanks again for the input. I've tried adding this opacity code to .sub-menu a ( zero because I want the box color to be transparent so that you don't see the box, only the type):

    <style type="text/css">
    .sub-menu { text-align: left;
    }
    .sub-menu a{
    background-color: #ffffff;
    opacity:0.0;
    filter:alpha(opacity=0); /* For IE8 and earlier */
    }
    </style>

    and I am getting this:



    Apparently the .sub-menu is the box containing the .sub-menu a individual items. Adding the zero opacity style to .sub-menu a just made the type disappear. This is tough.

  • #6
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,166
    Thanks
    23
    Thanked 601 Times in 600 Posts
    You set it to show nothing opacity:0.0; Try opacity:0.5;
    Be aware that both the back ground and the text will have this opacity. If you want the back ground only... The easiest and maybe the only way I know is to use a background image and make it opaque, but it does add to content and load speed.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #7
    New to the CF scene
    Join Date
    Mar 2014
    Location
    Bangalore
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sub-menu li a { color:#cccccc; }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •