一个小需求,页面过长,业务希望将按钮悬浮于页面上,不要一下拉就盖掉操作按钮。
代码如下:
<div id="dg" style="z-index: 9999; position: fixed ! important; right: 0px; top: 0px;">
<table width=""100% style="position: absolute; width:260px; right: 0px; top: 0px;">
//table 内部控件代码
</table>
</div>
div position参数设置为fixed 其相对于浏览器为绝对位置,通过设置right和top将div固定在右上角。
table position参数设置为absolute,其相对于第一层div绝对定位,通过设置right和top将table固定在div容器的右上角。