首页 > 代码库 > css中position:relative和overflow:hidden的问题

css中position:relative和overflow:hidden的问题

  1. <div style="height:100px; width:100px; background:#CCC; overflow:hidden;">  
  2.     <div style="height:300px; width:90px; background:#999; position:relative;"></div>  
  3. </div>  

解决方案:将父标签的position也设置成relative,代码如下:

 
  1. <div style="height:100px; width:100px; background:#CCC; overflow:hidden; position:relative;">  
  2.     <div style="height:300px; width:90px; background:#999; position:relative;"></div>  
  3. </div>  

css中position:relative和overflow:hidden的问题