CSS中的水平居中菜单? [英] Horizontal Centered Menu in CSS?
本文介绍了CSS中的水平居中菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想做一个水平居中的菜单。我已经尝试使用像文本对齐中心和边缘自动,但不能让他们工作。我不想使用表格。
这是我的代码:
< footer class =container>
< div class =row>
< div class =span12>
< ul>
< li> footer info 1< / li>
< li> footer info 2< / li>
< li> footer info 3< / li>
< / ul>
< / div>
< / div>
解决方案>
使用提供的HTML:
ul {text-align:center; }
li {display:inline-block; } / *不要浮动它们* /
I want to make a horizontal centered menu. I have tried using things like text align center and margin auto but can't get them to work. I do not want to use a table.
Here's my code:
<footer class="container">
<div class="row">
<div class="span12">
<ul>
<li>footer info 1</li>
<li>footer info 2</li>
<li>footer info 3</li>
</ul>
</div>
</div>
解决方案
With the provided HTML:
ul { text-align: center; }
li { display: inline-block; } /* Don't float them */
这篇关于CSS中的水平居中菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文