PDA

View Full Version : Vertically center div with div



estesbubba
4 Aug 2011, 10:34 AM
Is there a webkit CSS property to easily vertically center a div within another div? I know with standard CSS there are several ways to do it, none of which seem clean. I have a custom Ext.List where each item can vary in height. I have a custom disclosure icon and want it centered vertically depending on height. What should be trivial is frustrating me.

estesbubba
4 Aug 2011, 11:04 AM
Funny - after hours of trying, making a forum post, my next Google search found the answer. Put this on the parent div:

display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-pack: center;
-webkit-box-align: center;

akshayjkadu
25 Jul 2014, 3:26 AM
#Content-innerCt {
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-pack: center;
-webkit-box-align: center;
vertical-align: middle !important;
}