如何水平地居中DIV列表? [英] How do I center a list of DIVs horizontally?
本文介绍了如何水平地居中DIV列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
想象下面的每一个点是一个div,我如何实现这一点?
我需要浮动然后左,为他们在同一行,但他们是对齐到左边。
Imagin each of the dots below is a div, How do I achieve this?
I need to float then left, for them to be in the same line, but them they are aligned to the left.
*
* * *
* * * * *
推荐答案
display:inline-block
对于孩子,加上 text-align:center
在包含 div
上就是你需要的。
display: inline-block
is perfect for this. That on the children, combined with text-align: center
on the containing div
is all you need.
查看: http:// jsfiddle .net / S4aFj / 2 /
这篇关于如何水平地居中DIV列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文