【发布时间】:2012-12-11 02:40:59
【问题描述】:
我有以下代码,我希望列表居中(现在它拉到左边)。知道为什么吗?
<div class="row" style="width:100%;text-align:center;">
<div class ="banner span12" style="padding-top: 0px; padding-bottom:0px;text-align:center;">
<p style="font-size:18px;padding-top:6px;"> Or Start Browsing the Library ... </p></center>
</div>
<br>
<br>
<ul class="nav nav-pills" style="text-align:center;">
<li class="active" style="text-align:center;">
<a href ="#"> Library1 </a>
</li>
<li>
<a href ="#"> Library2 </a>
</li>
<li>
<a href ="#"> Library3 </a>
</li>
</ul>
导航药丸 CSS:
.nav-pills > li > a {
padding-top: 8px;
padding-bottom: 8px;
margin-top: 2px;
margin-bottom: 2px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.nav-pills > .active > a,
.nav-pills > .active > a:hover {
color: #ffffff;
background-color: #0088cc;
}
【问题讨论】:
-
我们可以看看您的
ul、li和"nav nav-pills"类声明吗?另外,你说的是什么浏览器?它在 Chrome 中完美居中:jsfiddle.net/E2cT7 -
我看到你正在使用引导程序。以下链接可能会回答您的问题:stackoverflow.com/questions/9421966/… 和 stackoverflow.com/questions/7165423/…
-
感谢奥列格这是问题所在。
标签: html css twitter-bootstrap