Home › Forums › CSS › Vertical Align with Auto height parent › Re: Vertical Align with Auto height parent
April 26, 2012 at 1:36 am
#101783
Itchybrain
Member
If the child element has a known/fixed height, I’ve often used a setup where I absolutely position the child in the parent using with a top position of 50%. Then move the child element up using a negative margin whose dimension is half it’s own height.
For example, a 150px high div (child) will be moved up -75px.
Not sure what to do with child elements who have a dynamic height. Perhaps use jQuery to get the element’s height, divide by two and insert that into the negative margin using inline css via jquery?