【发布时间】:2020-05-07 22:55:25
【问题描述】:
<nav class="navbar navbar-light bg-light">
<a class="navbar-brand" href="#">
<img src="/docs/4.4/assets/brand/bootstrap-solid.svg" width="30" height="30" class="d-inline-block align-top" alt="">Bootstrap</a>
<div class="d-flex justify-content-center">
<form class="form-inline">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
我试图将元素放在导航栏的中心。但不是放置在导航栏的中心,而是放置在导航栏的末端。那么如何将这个搜索栏放在导航栏的中心呢?
【问题讨论】:
-
您应该在您的问题中包含相关的 HTML 和 CSS - 懒惰地截取您的浏览器的屏幕截图不是我们可以提供的任何帮助。您的问题必须包含minimal, reproducible example
-
@Shiny 对不当行为感到抱歉,刚刚添加了代码示例。我希望你能在这件事上提供帮助。
-
这能回答你的问题吗? Bootstrap Center Navbar Items
标签: html css twitter-bootstrap twitter-bootstrap-3 bootstrap-4