2009-06-18 81 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的照顾。较高=前景。

相关问题