- 
                Why does auto attribute not work vertically?almost 10 years ago 
- 
          
          almost 10 years ago 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. 
- 
          
 
                      
                      
                      
    
    

1 Answer(s)