0

Code like this:

.element {   
     position: absolute; 
     left: 0; 
     top: 0; 
     right: 0; 
     bottom: 0;   
     margin: auto;    /* **if i add this ,element will align center**  */  
}  

How can left, right, top, bottom all equal 0? doesn't it mean distance equal 0? I can't understand how this CSS work.

thepio
  • 6,193
  • 5
  • 35
  • 54
L.Ann
  • 88
  • 9
  • Uhm? The `margin: auto` doesn't change anything. What browser are you using? Are you sure you have not set the width and height of the div elsewhere? – thepio Sep 16 '16 at 06:45
  • en,i use chome now ,sorry , i describe it particular if i delete left,right,top,bottom=0;only margin:auto; it doesn't work. i must use left,right,bottom,top=0;and margin:auto; can work prefect. – L.Ann Sep 16 '16 at 06:53
  • so i can't understand why left,right,top,bottom=0;play a important role in there, doesn't it mean the distance of my element to four side, I put my element(div) in a bigger
    – L.Ann Sep 16 '16 at 06:58

0 Answers0