css – 动态居中更新进度Gif

作者:互联网

2026-03-27

HTML教程
我正在使用Ajax updateprogress而且我附加了一个加载gif,问题是我怎么能强迫loading.gif在屏幕的中心,即使你在页面的最底部/顶部?有没有办法让它始终出现在中心?我希望用户在中心看到加载gif始终为他们通知页面仍在加载..

.CenterPB    {        position: absolute;        left: 50%;        top: 50%;        margin-top: -20px; /* make this half your image/element height */        margin-left: -20px; /* make this half your image/element width */        width:auto;        height:auto;    }               
Loading ...

谢谢!

我假设你希望它保持在中间,即使滚动.然后你必须改变:

position: absolute;

position: fixed;