David John Farmer
My quick playground for bits of JQuery and code...


Position an absolutely positioned element vertically within its relatively positioned parent (essentially automatically figures out the parent height and adds negative margin of half its own height), works responsively too...

AbsoluteMiddle & MaintainRadio Example Usage

When using MaintainRatio you don't have to set it to be a square (you set a ratio), you can also set an offset.

The example below also shows use of AbsoluteMiddle - this sets an absolutely positioned element vertically to the middle, regardless of its parent size or how big it is (responsive too).

Note: Your 'in the middle' element must be absolutely positioned, and the parent item must be relative.

Im Rectange on Resize and my label is slightly longer

Download AbsoluteMiddle