悬浮层图片:一个DIV简单搞定

悬浮在固定浮着的位置(即使滚动也浮在那里):
<div style=”position:fixed;_position:absolute;width:100px;height:80px;left:0;right:0;margin:0 auto;top:1px;” >
<img src=”image/img.png”>
</div>

悬浮在绝对位置(在网页中的位置,滚动不浮在那里,可以滚动走):
<div style=”position:absolute;width:100px;height:80px;left:0;right:0;margin:0 auto;top:1px;” >
<img src=”image/img.png”>
</div>

———————————————————————-

设置宽高是为了指定悬浮层的大小,防止遮住其他地方,而影响住其他地方的操作
width:100px;height:80px;

绝对居中:
left:0;right:0;margin:0 auto;

顶部距离:
top:1px;

(其他)左右距离:
left:30%
right:30%

注:
要调整左右,需先去掉”绝对居中”才可调整
要贴近底部,需先去掉”顶部距离”,然后用bottom:1px;

———————————————————————-

底部浮层样例:
<div style=”position:fixed;_position:absolute;width:100%;height:80px;left:0;right:0;margin:0 auto;bottom:1px;” >
<img src=”img.jpg” width=”100%” height=”80px”>
</div>