2013-12-20 76 views
2

http://jsfiddle.net/L9tqk/2/位置不能固定

bottom:0; 

时#footer的普通窗口它正确放置,我不能把我的页脚在正确的位置

<div id="logo"></div> 
<div id="content"> 
    <div id="trans"> 
    <div id="data"> 
     <div id="left"> </div> 
     <div id="right"> </div> 
    </div> 
</div> 
<div id="footer"></div> 


#footer { 
position:relative; 
width:100%; 
clear:both; 
} 

,但是当窗口大小改变,页脚位置不正确。

+0

补充的位置是:固定; – Karuppiah

+0

@Indian:我尝试过,但是当窗口大小调整后,所有其他内容都会关闭,但页脚仍然保持不变。 – neel

+1

final:http://jsfiddle.net/L9tqk/10/ – Karuppiah

回答

1

#content #trans删除position:absolute;并设置float它:

DEMO

#content #trans { 
    background: rgba(0,0,0,0.3); 
    width:100%; 
    height:auto; 
    float:left; 
    border-radius:5px; 
    color:Red; 
    } 
+0

非常感谢您... – neel

+0

@Parvathiiiii您的欢迎:) –

0

更改这个CSS位置相对和它的作品

#content #trans { 
    background: rgba(0,0,0,0.3); 
    width:100%; 
    height:auto; 
    position:relative; 
    top:0px; 
    left:0px; 
    z-index:-1; 
    border-radius:5px; 
    color:Red; 
    } 

更新小提琴

http://jsfiddle.net/L9tqk/9/

1

fixed位置页脚。

#footer{ 
    position:fixed; 
} 

Demo here.

OR:

hidden溢出#content #trans

写:

#content #trans{ 
    overflow:hidden; 
} 

DEMO here.

0
#footer { 
    position:fixed; 
    left:0px; 
    bottom:0px; 
    height:30px; 
    width:100%; 
    background:#999; 
} 

/* IE 6 */ 
* html #footer { 
    position:absolute; 
    top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px'); 
} 

这适用于几乎所有的Web浏览器。它仍然是固定的,所有其他内容都将落后它。

1
#content #trans { 
    background: rgba(0,0,0,0.3); 
    width:100%; 
    height:auto; 
    float:left; 
    top:0px; 
    left:0px; 
    z-index:-1; 
    border-radius:5px; 
    color:Red; 
    } 

OR

#footer { 
position:fixed; 
    bottom:0; 
    width:100%; 
    clear:both; 
} 
1

试试这个

#footer { 
    position:absolute; 
    width:100%; 
    clear:both; 
    bottom:0; 
}