Solved

Sub navigation colors

Posted on 2013-11-08
3
144 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
  • 2
3 Comments
 
LVL 52

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

929 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now