• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 101
  • Last Modified:

css active menu to be highlighted...

Hello, I am working on the HTML/css code shown below. When I select a menu I would like the underline color to stay different till I select the next menu item. How can I do this?

/****CSS for the top menu***/
.underlinemenu{
font-weight: bold;
width: 100%;
}
 
.underlinemenu ul{
padding: 16px 0 7px 0; /*6px should equal top padding of "ul li a" below, 7px should equal bottom padding + bottom border of "ul li a" below*/
margin: 0;
text-align: center; //set value to "left", "center", or "right"*/
}
 
.underlinemenu ul li{
display: inline;
}
 
.underlinemenu ul li a{
color: #494949;
padding: 6px 3px 4px 3px; /*top padding is 6px, bottom padding is 4px*/
margin-right: 20px; /*spacing between each menu link*/
text-decoration: none;
border-bottom: 3px solid gray; /*bottom border is 3px*/
}
 
.underlinemenu ul li a:hover, .underlinemenu ul li a.selected {
border-bottom-color:#f9a63f ;
}



/*****End CSS Menu ***/

Open in new window


<div class="underlinemenu">
<ul>
<li><a href="companyInfo.php">Company </a></li>
<li><a href="branchInfo.php">Branch </a></li>
<li><a href="branch_store.php">Store</a></li>
</ul>
</div>

Open in new window


Thanks for the help.

A
0
aej1973
Asked:
aej1973
2 Solutions
 
Steve BinkCommented:
Try targeting the :active or :focus pseudo-classes:
.underlinemenu ul li a:hover, .underlinemenu ul li a.selected, .underlinemenu ul li a:focus, .underlinemenu ul li a:active {
border-bottom-color:#f9a63f ;
}

Open in new window

0
 
SSupremeCommented:
Move pseudo-class :hover to li element, like here:
.underlinemenu ul li:hover a, .underlinemenu ul li a.selected {
border-bottom-color:#f9a63f ;
}

Open in new window

0
 
aej1973Author Commented:
Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now