We help IT Professionals succeed at work.
Get Started

css active menu to be highlighted...

aej1973 asked
Last Modified: 2015-04-16
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***/
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">
<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>

Open in new window

Thanks for the help.

Watch Question
Top Expert 2004
This problem has been solved!
Unlock 2 Answers and 3 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE