I have a few nested divs and i need to vertically center one of the nested divs. Normally i’d do this by giving the outer div the css property position: relative and the inner div the property position: absolute. I can then easily use top and left to position the div.
But i can’t get it done with my current structure. Here’s an example:
So basically from that example, the div with the blue border should be vertically centered inside the green div. But i can’t get it done.
Anyone any idea how to do this?
PS. I can only add css properties to the .item div and everything inside it.
Try this:
jsFiddle example
For this to work in IE7, a JavaScript hack is necessary:
Just replace the
.table*classes with the appropriate ones.