盒子上下左右居中或任意位置(登录框位置设计)

结果

 

 

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <meta http-equiv="X-UA-Compatible" content="IE=edge">
 6     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 7     <title>Document</title>
 8 
 9 </head>
10 <body>
11     <div class="bigDiv">
12 
13     </div>
14     
15 </body>
16 </html>

 

 

 1     <style>
 2         .bigDiv{
 3             width: 400px;
 4             height: 400px;
 5             border: 1px solid #000 ;
 6             border-radius: 20px;
 7             position: absolute;
 8             left: 50%;
 9             top: 50%;
10             margin-left: -200px;
11             margin-top: -200px;
12         }
13         li {
14             list-style: none;
15         }
16     </style>

 

posted @ 2021-04-16 17:14  飞渝  阅读(144)  评论(0)    收藏  举报