gppblog

想得到如下的页面效果,例如用于遮罩层的位置控制:

image

页面代码:

<div class="divOuter">
    <div class="divInner">
        divInner为上图页面内居中显示的块
    </div>
</div>
尝试了多次,最后采用如下方案(不兼容ie5.5):
.divOuter  
{
    position:relative;
    margin:0 auto;  /* ie5.5 不支持 */    
    margin-top:25%; /* 设为25%时,距离上边距为页面高度的一半,不太理解,chrom、ff、ie6均如此 */
    width:300px; 
    height:200px;
}

.divInner  
{ 
    position:absolute; top:-50%;
    width:300px;
    height:200px; 
    background:#dedede;
}

 

 

 

分类:

技术点:

相关文章:

  • 2021-07-07
  • 2022-12-23
  • 2021-12-24
  • 2021-10-24
  • 2022-02-24
  • 2021-11-02
  • 2022-03-06
  • 2022-12-23
猜你喜欢
  • 2021-05-15
  • 2021-09-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2022-01-31
  • 2022-12-23
相关资源
相似解决方案