好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

ul中的li如何居中均匀分布呢_html/css_WEB-ITnose

其中ul设了固定宽了,li的宽是不定的,且li设成了inline-block了,如图,现在想让li们在ul中居中水平均匀分布,不知如何设置呢

回复讨论(解决方案)

<style type="text/css">
ul{margin:0 auto;padding:0;
width:400px;background:#F00;
text-align:center;
}
li{
list-style:none;
display:inline-block;
margin:0 10px;width:100px;
background:#0F0;}</style><ul>	
<li>1</li><li>2</li><li>3</li></ul> 

纯css只有给li定宽度才行。 不然就只有用js去算了。

查看更多关于ul中的li如何居中均匀分布呢_html/css_WEB-ITnose的详细内容...

  阅读:30次