我正在尝试找到一种方法在响应式引导导航栏的精简视图中包含一些简单的文本内容,但到目前为止没有任何效果。我想要的只是导航栏右上角的一些简单的 [Username] [Log Off],当屏幕太小或调整窗口大小时,它不会赶上其他被制作成可通过按钮访问的列表。我希望登录信息保持在该按钮的右侧,并且在全视图中也与右侧对齐(页面链接向左对齐)。
身体:
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="~/Home/Index">Index</a>
@Html.Partial("_TopMenuPartial")
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
...
</body>
_TopMenuPartial:
<div class="row">
<div class="nav-collapse">
<ul class="nav">
<li class="divider-vertical"></li>
<li class="active"><a href="~/Home/Index">Home</a></li>
<li class="divider-vertical"></li>
<li class="active"><a href="#">Link 2</a></li>
<li class="divider-vertical"></li>
<li class="active"><a href="#">Link 3</a></li>
<li class="divider-vertical"></li>
<li class="active"><a href="#">Link 4</a></li>
</ul>
</div>
</div>
_登录部分:
@if (Request.IsAuthenticated)
{
@Html.ActionLink(User.Identity.Name, "Manage", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })
using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) {
@Html.AntiForgeryToken()
<a href="javascript:document.getElementById('logoutForm').submit()">Log off</a>
}
}
else
{
@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })
@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })
}
感谢您提前提供任何帮助。我对处理这一切很陌生。