我有这段代码
<li class="dropdown" runat="server" id="btn_logout">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user">USER</i> <b class="caret"></b></a>
<ul class="dropdown-menu" style="background-color:black;">
<li class="dropdown-header">DROPDOWN HERE: </li>
<li><a href="#">Manage Account</a></li>
<li role="separator" class="divider"></li>
<li><a href="logout.php">Sign Out</a></li>
</ul>
</li>
我想在显示drop down here
的地方添加另一个下拉菜单。
我该怎么办?
答案 0 :(得分:1)
简短回答,引导菜单上的子菜单are not supported。
(TLDR)您可能会想到一些骇客:
.dropdown-submenu {
position: relative;
}
.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;
border-radius: 0 6px 6px 6px;
}
.dropdown-submenu:hover>.dropdown-menu {
display: block;
}
.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: #ccc;
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover>a:after {
border-left-color: #fff;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left>.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;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<li class="dropdown" runat="server" id="btn_logout">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user">USER</i> <b class="caret"></b></a>
<ul class="dropdown-menu" style="background-color:black;">
<li class="dropdown-submenu">
<a class="dropdown-item" href="#">another level</a>
<ul class="dropdown-menu" style="background-color:black;">
<li><a href="#">Manage Account</a></li>
<li role="separator" class="divider"></li>
<li><a href="logout.php">Sign Out</a></li>
</ul>
</li>
<li><a href="#">Manage Account</a></li>
<li role="separator" class="divider"></li>
<li><a href="logout.php">Sign Out</a></li>
</ul>
</li>