百分比宽度div如何水平居中

<div id="box">  
    <div id="container"></div>  
</div>  
#box{  
    position: relative;  
  
}  
#container{  
    position: absolute;  
    width:30%;  
    height:100px;  
    background: #ccc;  
    left: 0;  
    right: 0;  
    margin:100px auto;  
}  

 

猜你喜欢

转载自www.cnblogs.com/panlaixing/p/8953606.html