中心< ul> < li>进入div [英] Center <ul> <li> into div
本文介绍了中心< ul> < li>进入div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
经过一番搜索,我没有找到合适的方法将< li>
的列表定位到固定宽度 div
。
After some search, I did not find a proper way to center a list of <li>
into a fixed width div
.
Take a look at the page.. It doesn't work either!
推荐答案
由于 ul
和 li
元素是 display:block
=http://dorward.me.uk/www/centre/ =nofollow noreferrer>汽车边距和宽度小于其容器。
Since ul
and li
elements are display: block
by default — give them auto margins and a width that is smaller than their container.
ul {
width: 70%;
margin: auto;
}
如果您更改了他们的显示属性,规则(如浮动),那么这将不工作。
If you've changed their display property, or done something that overrides normal alignment rules (such as floating them) then this won't work.
这篇关于中心< ul> < li>进入div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文