1

My layout code

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/jquery")
    @RenderSection("scripts", required: false)
    <style>
        .art-hmenu li a {
            background-color: grey;
            color: yellow;            
        }
    </style>
</head>
<body>
    <div class="art-nav-inner">
        <ul class="art-hmenu">
            <li><a href="/Home/Index">Home</a></li>
            <li><a href="/About/Index">Contacts</a></li>
        </ul>
    </div>
    <div>
        @RenderBody()
    </div>
</body>
</html>

when I click link Home, I want it will change color menu Home when I click hyper link Contact, it will change color menu Contact and remove color menu Home

How can I achieve this?

thanks!

1
  • Welcome to Stackoverflow !! Please add your question here. " I want it will change color menu Home when I click hyper link Contact, it will change color menu Contact and remove color menu Home" this part is not clear and difficult to understand. Commented Jun 18, 2013 at 8:01

1 Answer 1

2

Try this.

.art-hmenu li a:link {color:#FF0000;}      /* unvisited link */
.art-hmenu li a:visited {color:#00FF00;}  /* visited link */
.art-hmenu li a:hover {color:#FF00FF;}  /* mouse over link */
.art-hmenu li a:active {color:#0000FF;}  /* selected link */ 

Change the color as per your requirements in the color:#...;

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.