在导航栏中,如何将标题居中"我的项目"并将注销按钮保留在与标题相同的行的右侧:
<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>
答案 0 :(得分:0)
使用此:
<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>
)))))
答案 1 :(得分:0)
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header" style="float: center;">
<form class="navbar-form " method="post" action="{{url_for("logout")}}">
<div align="center" >
<h1 > My Project <i class="glyphicon glyphicon-user white"></i> </h1>
<font style="color:#FFFFFF;font-size:10px;padding-right:5px;">{{ g.user.get_name() }}</font>
<p class="collapse navbar-collapse" id="bs-example-navbar-collapse-1" >
<ul class="nav navbar-nav navbar-right">
<p class="navbar-right"><button id="logout" type="submit" class="btn btn-success">Logout</button>
</p>
</ul>
</p>
</div>
</form>
</div>
</div>
</nav>
答案 2 :(得分:0)
你可以通过简单的css
来做到这一点<style>
.container {
position:relative;
}
.navbar-collapse {
position:absolute;
right:0px;
top:0px;
}
</style>