开发者

Center <UL> in <DIV>

I tried many solution from stackoverflow to center my <UL> with no success. Can anyone check it?

http://mihalko.eu/index.php

I want to center "S开发者_如何转开发hop 943 01 ... not available".

Thanks


HTML :

<div class="div">
<ul>
<li>Test 1</li>
<li>Test 2</li>
<li>Test 3</li>
</ul>
</div>

CSS :

.div {
    text-align: center;
}
.div ul {
    margin: 0 auto;
}
.div ul li {
    width: 100px;
    display: inline-block;
}


If you set a fixed width on the ul you can use auto as value for the horizontal margin to center the ul.

ul {
   margin: 0 auto;
   width: 200px;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜