Solved

Sub navigation colors

Posted on 2013-11-08
3
147 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
align Linkedin sign to the right page 5 34
Materializecss - Different Behaviors in Browser's 1 35
CSS Logo Problem. 2 20
push logos in footer up higher 5 20
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

813 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

10 Experts available now in Live!

Get 1:1 Help Now