Html 如何将导航条居中对齐

Html 如何将导航条居中对齐,html,css,asp.net-mvc,twitter-bootstrap,Html,Css,Asp.net Mvc,Twitter Bootstrap,我想为我的页脚使用导航,就像它被用作默认ASP.NET MVC应用程序的标准菜单一样。样式看起来不错,对我来说很有意义,所以坚持这种配置会很好。如何在不修改CSS的情况下将其居中?我担心的是,由于标题也使用class=nav-navbar-nav,如果我将导航CSS调整为text align:center;会弄乱页面顶部的主菜单。有什么建议吗 注意:我知道我以前使用了类似于style=text align:center的方法对主导航栏菜单项进行了对齐;但我不记得怎么做了 <footer&g

我想为我的页脚使用导航,就像它被用作默认ASP.NET MVC应用程序的标准菜单一样。样式看起来不错,对我来说很有意义,所以坚持这种配置会很好。如何在不修改CSS的情况下将其居中?我担心的是,由于标题也使用class=nav-navbar-nav,如果我将导航CSS调整为text align:center;会弄乱页面顶部的主菜单。有什么建议吗

注意:我知道我以前使用了类似于style=text align:center的方法对主导航栏菜单项进行了对齐;但我不记得怎么做了

<footer>
        <div class="container-fluid"> //Necessary?
            <div class="row">  //Necessary?
                <div class="col-md-12">  //Necessary?
                        <ul class="nav navbar-nav" style="text-align:center;">  //Trying to adjust the style to center align
                            <li class="dropdown">
                                <a class="dropdown-toggle" role="button" aria-expanded="false" href="#" data-toggle="dropdown">Home <span class="caret"></span></a>
                                <ul class="dropdown-menu" role="menu">
                                    <li>@Html.ActionLink("Item 1", "Index", "Home", protocol: null, hostName: null, fragment: "item1", routeValues: null, htmlAttributes: null)</li>
                                    <li>@Html.ActionLink("Item 2", "Index", "Home", protocol: null, hostName: null, fragment: "item2", routeValues: null, htmlAttributes: null)</li>
                                    <li>@Html.ActionLink("Item 3", "Index", "Home", protocol: null, hostName: null, fragment: "item3", routeValues: null, htmlAttributes: null)</li>
                                </ul>
                            </li>
                            <li>@Html.ActionLink("About", "About", "Home")</li>
                            <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
                        </ul>
                </div>
            </div>
        </div>
</footer>
编辑:

我发现在标签中,执行以下操作可以创建基本导航栏的外观和感觉

<ul class="nav navbar-nav">

此外,还有navbar left和navbar right类,它们使navbar向左或向右对齐,但没有中心。关于创建导航栏中心有什么建议吗?

如果您可以访问css

footer ul li {
text-align:center;
}
或者从html

<div class="row" style="text-align:center;">

试试这个代码?设置div的宽度导航栏的宽度

金球:页脚。容器流体{margin:0 auto;text align:center;};只有在容器流体上有固定宽度或使用%来处理棒时,它才会起作用。