webconfig
<siteMap defaultProvider="MvcSiteMapProvider">
<providers>
<clear />
<add name="MvcSiteMapProvider" type="MvcSiteMapProvider.DefaultSiteMapProvider, MvcSiteMapProvider" siteMapFile="~/Mvc.Sitemap" />
</providers>
</siteMap>
mvc.sitemap
<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0"
xsi:schemaLocation="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0 MvcSiteMapSchema.xsd">
<mvcSiteMapNode title="Log In" controller="Auth" action="LogIn" visibility="!Auth">
<mvcSiteMapNode title="Log In (vertical form)" controller="Auth" action="LogInVerticalForm" visibility="!Auth" />
<mvcSiteMapNode title="Home" controller="Home" action="Index"/>
<mvcSiteMapNode title="About" controller="Home" action="About"/>
<mvcSiteMapNode title="Hobby" clickable="false">
<mvcSiteMapNode title="User Mgmt" controller="Home" action="Football" />
<mvcSiteMapNode title="Role Mgmt" controller="Home" action="RoleMgmt" />
</mvcSiteMapNode>
<mvcSiteMapNode title="Account" controller="User" action="Account" visibility="Member,Manager,Supervisor" />
<mvcSiteMapNode title="Users" controller="Admin" action="UserList" visibility="Admin" >
<mvcSiteMapNode title="Edit User" controller="Admin" action="EditUser"/>
</mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMap>
CSS
.dropdown-submenu {
position: relative;
}
// Default dropdowns
.dropdown-submenu > .dropdown-menu {
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
-webkit-border-radius: 0 6px 6px 6px;
-moz-border-radius: 0 6px 6px 6px;
border-radius: 0 6px 6px 6px;
}
.dropdown-submenu:hover > .dropdown-menu {
display: block;
}
// Dropups
.dropup .dropdown-submenu > .dropdown-menu {
top: auto;
bottom: 0;
margin-top: 0;
margin-bottom: -2px;
-webkit-border-radius: 5px 5px 5px 0;
-moz-border-radius: 5px 5px 5px 0;
border-radius: 5px 5px 5px 0;
}
// Caret to indicate there is a submenu
.dropdown-submenu > a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 5px 0 5px 5px;
border-left-color: darken(@dropdownBackground, 20%);
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover > a:after {
border-left-color: @dropdownLinkColorHover;
}
// Left aligned submenus
.dropdown-submenu.pull-left {
// Undo the float
// Yes, this is awkward since .pull-left adds a float, but it sticks to our conventions elsewhere.
float: none;
> .dropdown-menu {
left: -100%;
margin-left: 10px;
-webkit-border-radius: 6px 0 6px 6px;
-moz-border-radius: 6px 0 6px 6px;
border-radius: 6px 0 6px 6px;
}
}
.dropdown .dropdown-menu .nav-header {
padding-left: 20px;
padding-right: 20px;
}
菜单现在看起来像这样: https://postimg.org/image/nqfzmbka9/
但我想制作一个像这样的菜单:https://postimg.org/image/4qymp4odj/