使用position:fixed實現固定位置

CSS的部份:
*{ margin:0; }
html,body{ height:100%; overflow:auto; }
.warp{ height:100%; width:100%; position:relative; overflow:auto; }
.box{ position:fixed; left:10px; top:180px; background-color:#CCCCCC; }
* html .box{ position:absolute; }

HTML的部份:
<div class="warp">Input content on there</div>
<div class="box">This is fixed box</div>

如果IE6成為歷史,那麼實現的方式將會更加簡單.

沒有留言: