negative margins负边距,会使结构塌陷,利用这个特点来实现。
<div class="parent-frame" style="position: relative;">
 
 利用绝对定位,配合margin的负值来实现居中。
 
 <div class="child-frame" style="position: absolute; top: 50%; left: 50%; margin-top: -51px; margin-left: -51px;">
 
 负边距来实现,水平垂直居中。需要知道该元素的具体大小
 
 </div>
 
</div>
	利用绝对定位,配合margin的负值来实现居中。 负边距来实现,水平垂直居中。需要知道该元素的具体大小
                    	
                    	
                    	  
                    	    
                    	    
                    	    
                    	 
    如果您觉得本文的内容对您的学习有所帮助:
     
                    	
                    	   
                    	   关键字:
DIV