简体   繁体   English

<a>点击时</a>改变颜色<a>(asp.net mvc 4 visual studio 2012)?</a>

[英]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.

相关问题 如何在Visual Studio 2012上使用ASP.NET(包含MVC)C#配置或设置Log4Net - How to configure or setup Log4Net with ASP.NET ( included MVC) C# on Visual Studio 2012 ~ ~ 在Visual Studio 2012调试期间ASP.Net MVC4上未显示CSS - CSS not showing on ASP.Net MVC4 during Visual Studio 2012 Debug 哪个实体框架在 Visual Studio 2012 和 ASP.NET MVC 4 和 Windows 7 中使用? - Which Entity Framework is used in Visual Studio 2012 with ASP.NET MVC 4 with Windows 7? 如何在Visual Studio 2012中为ASP.NET MVC 4配置Microsoft.Owin.Security.Google? - How to configure Microsoft.Owin.Security.Google for ASP.NET MVC 4 in Visual Studio 2012? 更新Visual Studio 2012后无法创建ASP.NET MVC 5项目 - Can't create ASP.NET MVC 5 project after updating Visual Studio 2012 如何在Visual Studio 2012上查看ASP.NET MVC移动页 - How to view an ASP.NET MVC mobile page on Visual Studio 2012 在Visual Studio 2012中打开的asp.net mvc3应用程序,无法找到程序集“EntityFramework” - asp.net mvc3 application opened in Visual Studio 2012, Could not locate the assembly “EntityFramework” 无论如何在ASP.NET MVC3应用程序的Visual Studio 2012中使用PageInspector? - Anyway to use PageInspector in Visual Studio 2012 in ASP.NET MVC3 app? Visual Studio Professional 2012错误:此项目引用ASP.NET MVC项目中缺少的NuGet包 - Visual Studio Professional 2012 error: This project references NuGet package(s) that are missing in ASP.NET MVC project 在Visual Studio 2012中更改asp.net成员表的目录 - changing directory of asp.net membership tables in visual studio 2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM