2012-04-29 13 views
0

私は、次のheirachy動的に作成するdiv poistioning問題

<div class="box"> 
Content goes here 
<div class="footer>Footer</div> 
</div> 
<div class="box"> 
Content goes here 
<div class="footer>Footer</div> 
</div> 
<div class="box"> 
Content goes here 
<div class="footer>Footer</div> 
</div> 

メインボックス「ボックス」にdivを作成していスクロール可能です。私はフッターの "フッター"を親コンテナの下に残しておきたいと思います。私は3日間グーグルでやっている。何も働かなかった。非常に心配です。助けてください

+1

あなたは、それは関係なく、スクロールの箱の底に固執したいわけ?あなたのCSSコードを共有してください。 –

答えて

1

Sarfraz上記のような絶対位置と下端0を使用する必要があります。ここ

はサンプルコードです:

<html> 
<head> 
<style> 
body { width:100%;} 
.box { float: left; height: 200px; margin-right: 5%; position: relative; width: 20%;} 
.footer {bottom: 0px; position: absolute; width: 100%; text-align: center;} 
.box_content{ height: 180px; overflow-y: scroll;} 
.clear { clear:both;} 
</style> 
</head> 
<body> 
<div class="box"> 
    <div class="box_content"> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
    </div> 
    <div class="footer">Footer</div> 
</div> 
<div class="box"> 
    <div class="box_content"> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
    </div> 
    <div class="footer">Footer</div> 
</div> 
<div class="box"> 
    <div class="box_content"> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
     Content goes here <br /> 
    </div> 
    <div class="footer">Footer</div> 
</div> 
<div class="clear"> </div> 
</body> 
</html> 
関連する問題