[英]Change color <a> when click (asp.net mvc 4 visual studio 2012)?
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! 谢谢!
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:#...;
根据您的要求改变color:#...;
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.