asp.net-mvc - 导航栏上的集中按钮

标签 asp.net-mvc html css navbar

我的导航栏上有以下按钮:

<ul class="nav navbar-nav navbar-right" >

    <div class="btn-group ex" data-toggle="buttons" style="vertical-align:middle">
        <label class="btn btn-primary btn-sm">
            <input type="radio" name="options" id="blocos" value="blocos"> <span class="glyphicon glyphicon-th"></span>
        </label>
        <label class="btn btn-primary btn-sm">
            <input type="radio" name="options" id="lista" value="lista"> <span class="glyphicon glyphicon-align-justify"></span>
        </label>
    </div>
    <a class="btn btn-success btn-sm" id="infopopover" rel="popover" data-style="primary"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></a>
    <input type="hidden" id="modoexibicao" />
    <input type="hidden" id="contratocod" />

    @Html.Partial("_LoginPartial")

</ul>

它们如下所示:

enter image description here

我希望它们在导航栏的中心保持对齐。怎么办?

最佳答案

在你的样式表中添加:

ul{
    text-align: center;
}

或者如果您不希望此样式引用任何其他 ul,则将“text-align:center”添加到您的 ul 元素中的其他适用类之一。

关于asp.net-mvc - 导航栏上的集中按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39537503/

相关文章:

Jquery 对话框和下拉框

javascript - Handlebars 显示 html 标签而不是将其视为 html 标签

在子文件夹中运行 MVC 的 Asp.net WebForms 应用程序

javascript - 构造新对象时未捕获类型错误

html - 导航栏中 anchor 中的点

html - 在移动 View 中我的网页上不是全宽页脚

html - 主图库图像未居中

html - Flexbox 在摘要标签中不起作用

javascript - 将鼠标悬停在省略号上时显示范围标题

html - 布局在 Localhost 上看起来不错,但在实时网站上出现问题?