Join the social network of Tech Nerds, increase skill rank, get work, manage projects...

 1 Answer(s)

  • vertical-align:middle because it's not applicable to block-level elements

    margin-top:auto and margin-bottom:auto because their used values would compute as zero

    margin-top:-50% because percentage-based margin values are calculated relative to the width of containing block

    In fact, the nature of document flow and element height calculation algorithms make it impossible to use margins for centering an element vertically inside its parent. Whenever a vertical margin value is changed, it will trigger a parent element height re-calculation (reflow), which would in turn trigger a re-center of the original element.

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: