fixed定位div水平垂直居中

定位为fixed的是保存成功提示,需要设置width和height。

<div class="store-success" style="display: none" id="storeSuccess">
    <span>保存成功</span>
</div>

.store-success {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    margin: auto;
    width: 80px;
    height: 20px;
    line-height: 20px;
    padding: 5px 10px;
    color: #fff;
    font-size: 14px;
    text-align: center;
    background: rgba(0,0,0,0.5);
}

相关文章:

  • 2021-08-28
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
猜你喜欢
  • 2022-01-05
  • 2021-12-01
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2021-10-29
相关资源
相似解决方案