3
我試圖用bootstrap4beta和dropdown-menu
構建一個垂直菜單。我希望下拉菜單顯示在右側。但與dropdown-menu-right
我只能讓它出現在下一行,而不是相同的。怎麼做?如何使此下拉菜單與其父項顯示在同一行上?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="nav flex-column col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4">
<a class="nav-link active backgroundnav" href="#">HTML</a>
<a class="nav-link backgroundnav" href="#">CSS</a>
<a class="nav-link backgroundnav" href="#">JavaScript</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle backgroundnav" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
Preview
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="Preview">
<a class="dropdown-item" href="#">Mobile Phone</a>
<a class="dropdown-item" href="#">Tablet</a>
<a class="dropdown-item" href="#">Laptop</a>
<a class="dropdown-item" href="#">Desktop</a>
</div>
</li>
</nav>
感謝。