Reputation: 41
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!
Upvotes: 1
Views: 1251
Reputation: 15769
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.
Upvotes: 2