我是flex的新手,老板希望我为此只使用flexbox!问题是我试图让导航菜单显示在它自己的行中,但是它一直环绕在搜索图标等旁边。我在代码的它自己的行中有它,所以我不知道为什么它并排出现
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<nav class="navbar navbar-expand-lg">
<div class="container">
<div class="d-flex flex-row w-100">
<div class="flex-column">
company logo here
</div>
<div class="flex-column">
<a class="navbar-brand" href="#">
company name here
</a>
</div>
<div class="flex-column justify-content-end">
search icon here
</div>
<div class="flex-column justify-content-end">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</div>
<div class="d-flex flex-row w-100">
<div class="flex-column justify-content-start">
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</nav>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
答案 0 :(得分:1)
答案 1 :(得分:0)
我假设您的意思是菜单的按钮一直显示在搜索图标旁边。这是因为按钮与搜索图标位于同一行。您说对了,菜单本身在其自己的行中,但按钮不在其中。