html - Bootstrap : center the title on the navbar and move logout button right

标签 html css twitter-bootstrap

在导航栏中,如何将标题“我的元素”居中并将注销按钮保持在与标题同一行的右侧:

<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
  <div class="container">
    <div>
        <h1>My Project</h1>
    </div>
    <div class="navbar-collapse collapse">
      <form class="navbar-form navbar-right" method="post" action="{{url_for("logout")}}">
        <i class="glyphicon glyphicon-user white"></i>
        <font style="color:#FFFFFF;font-size:10px;padding-right:5px;">{{ g.user.get_name() }}</font>
        <button id="logout" type="submit" class="btn btn-success">Logout</button>
      </form>
    </div>
  </div>
</div>

最佳答案

使用这个:

<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container">
        <div>
            <h1 align="center"><div class="navbar-collapse collapse">
                <form class="navbar-form navbar-right" method="post" action="{{url_for("logout")}}">My Project
                    <i class="glyphicon glyphicon-user white"></i>
                    <font style="color:#FFFFFF;font-size:10px;padding-right:5px;">{{ g.user.get_name() }}</font>
                    <input id="logout" type="submit" class="btn btn-success" value="Logout">
                </form>
            </div></h1>
        </div>

    </div>
</div>

最长 <h1>你见过)))))

关于html - Bootstrap : center the title on the navbar and move logout button right,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22970069/

相关文章:

html - 使 Flex div 的大小与其内容相同

javascript - 在 html 中创建 javascript 循环

javascript - 是否可以隐藏 HTML 元素?

html - 子 Div 的显示 :none is not working

html - 使用 Bootstrap 网格系统将图像响应地放置在 div 旁边

jquery - 日期选择器不会在 Bootstrap 模式中打开

Javascript 谷歌地图 api 在单独的文件中时不起作用

html - 如何将站点名称和标题放在图像上

css - 使用显示 : table-cell 垂直对齐两个图像

javascript - 如何在鼠标悬停时打开菜单折叠?