更改颜色当点击(asp.net MVC 4 visual studio 2012)
本文关键字:MVC net asp visual 2012 studio 颜色 | 更新日期: 2023-09-27 18:18:45
我的布局代码
<!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>
当我点击链接Home,我想它会改变颜色菜单Home当我点击超级链接联系人,它会改变颜色菜单联系人和删除颜色菜单Home
我怎样才能做到这一点?
谢谢!
试试这个
.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 */
根据color:#...;