Solved

Sub navigation colors

Posted on 2013-11-08
3
151 Views
Last Modified: 2013-11-11
Hello, I'm modifying a .css and I want to be able to have the .current state for a sub nav to be a different color than the .current state for a parent nav. Below is the hover color for a sub and the .current color.

#leftcol ul.menu ul li a:hover{
      color: #872835;
}

.menu .current a span {
  color: #EEC015;
}

What is the code for making the .current a span for a sub nav?
0
Comment
Question by:DancingFighterG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39635594
You don't have enough info to really help so I am going to improvise.  I am not using span's in this example http://jsbin.com/ukUrIxa/1/edit?html,css,output

Leave the #leftcol out of your css for the menu unless you have a class menu someplace else that requires different styles.  

.menu a{color:black;}
.menu .current a{color:red;}
.menu .current ul a{color:green;}

Open in new window

  <div id="leftcol">
     <ul class="menu">
          <li><a href="#">Item 1</a></li>
          <li class="current"><a href="#">Item 2</a>
               <ul>
                     <li><a href="#">Item 2.1</a></li>
                    <li><a href="#">Item 2.2</a></li>
               </ul>
          </li>
       <li><a href="#">Item 3</a>
               <ul>
                     <li><a href="#">Item 3.1</a></li>
                    <li><a href="#">Item 3.2</a></li>
               </ul>
          </li>
    </ul>
</div>

Open in new window

0
 

Author Comment

by:DancingFighterG
ID: 39639141
Here is all the section related to the menu look:

#leftcol ul{
      list-style:none;
}

#leftcol ul.menu li{
      line-height:20px;
}

#leftcol ul.menu ul li a span{
      padding-left: 20px;
}

.menu li a, .menu li a:link {
    background: url("../images/menu_arrow.gif") no-repeat scroll left top transparent;
    color: #fff;
    display: block;        
    font: bold 13px/33px verdana;
    height: 33px;
    padding-left: 20px;
    position: relative;
    text-align: left;
    text-decoration: none;
}

.menu li a:hover{
      color: #EEC015;
}

#leftcol ul.menu ul li a:hover{
      color: #872835;
}

.menu .parent ul li a {
      font: 12px/33px Verdana;
      background: url("../images/submenu.gif") no-repeat scroll left top transparent;
}

.menu .current a span {
  color: #EEC015;
}

________________________________________________________________________________

Overall the following code puts the correct color for the submenu items as a hover:

#leftcol ul.menu ul li a:hover{
      color: #872835;
}

With that being said when someone clicks on the submenu I need the submenu on click to stay the same color as the hover color. The following code is handling the coloring for all menus that are clicked

.menu .current a span {
  color: #EEC015;
}
0
 

Author Comment

by:DancingFighterG
ID: 39639296
Ok I figured it out
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question