text-align下的绝对定位对齐同时不占据空间实例页面

展示

回到相关文章 »

代码

CSS代码:
.sina_box{width: 960px; height: 480px; margin: 0 auto; background: url(http://img1.t.sinajs.cn/t4/skin/skin000/images/body_bg.jpg) top center; background-size: 100% 100%;}
.sina_backtop_box { border-bottom: 2px solid #fff; background-color:#34538b; text-align: right; }
.sina_backtop_h0 { height: 0; overflow: hidden; }
.sina_backtop { width: 20px; line-height: 1.2; padding: 5px 0; background-color: #DFF3FD; text-align: center; position: absolute; }
            
HTML代码:
<div class="sina_box">
    <div class="sina_backtop_box">
        &nbsp;<a href="#" class="sina_backtop">占据空间</a>
    </div>
    
    <div class="sina_backtop_box sina_backtop_h0">
        &nbsp;<a href="#" class="sina_backtop">不占据空间</a>
    </div>
</div>