gpt4 book ai didi

html - Bootstrap 4 导航栏中的超链接菜单渗入内联形式

转载 作者:太空宇宙 更新时间:2023-11-04 08:52:11 25 4
gpt4 key购买 nike

根据 Bootstrap 4 站点,带有表单的导航栏应该可以工作:

https://v4-alpha.getbootstrap.com/components/navbar/#forms

我使用 class="form-inline" 并在同一 html 级别上使用 ul-tag 和 3 个超菜单链接。

请参阅此代码笔:

http://codepen.io/anon/pen/eWOKXL?editors=1010

HTML

<nav class="navbar navbar-toggleable-md fixed-top navbar-light bg-faded">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<a class="navbar-brand" href="#">my-app</a>

<div class="form-inline my-2 my-lg-0">
<div class="form-group">
<div class="input-group">
<span class="input-group-btn">
<a class="btn btn-primary">Create</a>
</span>
<select class="form-control">
<option selected >Item AAAAAAAAAAAAAABBBBBBBBBB CCCCCCCCC</option>
</select> <span class="input-group-btn">
<div class="btn-group">
<button class="btn btn-secondary" >Open</button>
<button class="btn btn-secondary" data-placement="bottom" triggers="manual" #p="ngbPopover" [ngbPopover]="popContent"
popoverTitle="Delete?">Delete</button>
</div>
</span>
</div>
</div>
</div>

<ul class="navbar-nav mx-auto mt-2 mt-lg-0">
<li class="nav-item"> <a class="nav-link">link11111111111111</a></li>
<li class="nav-item"> <a class="nav-link">link22222222222222</a></li>
<li class="nav-item"> <a class="nav-link">link33333333333333</a></li>
</ul>

<div ngbDropdown class="justify-content-end d-inline-block">
<button class="btn btn-secondary" id="dropdownMenu1" ngbDropdownToggle>Items</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu1">
<button class="dropdown-item">Item1</button>
<button class="dropdown-item" >Item2</button>
</div>
</div>

</div>
</nav>

只要调整窗口大小,就会看到 3 个菜单链接会渗入 class="form-inline" 的主元素。

我该如何解决?查看 BS4 示例,我看到首先是菜单链接,然后是表单内联元素。我的情况正好相反。

最佳答案

我建议去掉 input-group 周围的 form-group。制作 2 个单独的 input-group-btn 而不是 btn-group。另外,请记住 BS4 仍处于 alpha 阶段,因此还不是稳定版本。

http://www.codeply.com/go/jFOUKGF10Z

<nav class="navbar navbar-toggleable-md fixed-top navbar-light bg-faded">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<a class="navbar-brand" href="#">my-app</a>
<div class="form-inline my-2 my-lg-0">
<div class="input-group">
<span class="input-group-btn">
<a class="btn btn-primary">Create</a>
</span>
<select class="form-control pr-4">
<option selected="">Item AAAAAAAAAAAAAABBBBBBBBBB CCCCCCCCC</option>
</select>
<div class="input-group-btn">
<button class="btn btn-secondary">Open</button>
</div>
<div class="input-group-btn">
<button class="btn btn-secondary" data-placement="bottom" triggers="manual" #p="ngbPopover" [ngbpopover]="popContent" popovertitle="Delete?">Delete</button>
</div>
</div>
</div>
<ul class="navbar-nav mx-auto mt-2 mt-lg-0">
<li class="nav-item"> <a class="nav-link">link11111111111111</a></li>
<li class="nav-item"> <a class="nav-link">link22222222222222</a></li>
<li class="nav-item"> <a class="nav-link">link33333333333333</a></li>
</ul>
<div ngbdropdown="" class="justify-content-end d-inline-block">
<button class="btn btn-secondary" id="dropdownMenu1" ngbdropdowntoggle="">Items</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu1">
<button class="dropdown-item">Item1</button>
<button class="dropdown-item">Item2</button>
</div>
</div>
</div>
</nav>

关于html - Bootstrap 4 导航栏中的超链接菜单渗入内联形式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43355295/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com