<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>水平、垂直居中Div</title>
    <meta charset="utf-8" />
    <style>
        .CenterBox {
            position: fixed;
            top: 40%;
            left: 50%;
            background-color: #eee;
            border-radius: 15px;
            padding: 15px;
            width: 350px;
            -webkit-transform: translateX(-50%) translateY(-50%);
            -moz-transform: translateX(-50%) translateY(-50%);
            -ms-transform: translateX(-50%) translateY(-50%);
            transform: translateX(-50%) translateY(-50%);
        }
    </style>
</head>
<body>
    <div class="CenterBox">
        asd
    </div>
</body>
</html>

 

相关文章:

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