2009-06-18 23 views

回答

6

使用css position:fixed;

#fixedDiv { 
    position: fixed; 
    left: 20px; 
    top:20px; 
    width: 50px; 
    height: 50px; 
} 

對於IE6,請參閱http://www.cssplay.co.uk/layouts/fixed.html

+3

請注意,IE 6和以前不支持position:fixed,IE7和WebKit在將位置更改爲固定位置或從固定位置改變位置時都有奇怪的錯誤(請參閱http://quirksmode.org/css/position.html) – bdukes 2009-06-18 16:12:48

2
css-selector { 
    position: fixed; 
    top: 0; 
    left: 0; 
} 

採取的z-index的照顧。較高=前景。

相關問題