中心div垂直在%高度div? [英] center div vertically in a % height div?
本文介绍了中心div垂直在%高度div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以将一个div垂直居中在一个%height div中?
Is it possible to center a div vertically in a % height div?
推荐答案
以及整个互联网。快速搜索将带来大量的结果。无论如何,我首选的方法是使用 display:table-cell;
和 vertical-align:middle;
。有关示例,请参见此页。 (请注意,这在IE6上不起作用。)
This has been asked enough times here as well as all over the Internet. A quick search will bring you tons of results. Anyhow, my preferred way of doing this is to use display: table-cell;
and vertical-align: middle;
. See this page for an example. (Beware that this doesn't work on IE6.)
这篇关于中心div垂直在%高度div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文