2
3
4
5
Document6
7 *{
8 margin: 0;
9 padding: 0;
10 }
11 html,body{
12 width: 100%;
13 height: 100%;
14 }
15 body{
16 display: flex;justify-content: center;align-items: center;
17 }
18 .box{
19 width: 500px;
20 height: 500px;
21 border: 1px solid #ccc;
22 }
23
24
25
26
27
28
29
30
自己经常喜欢写一些测试代码,就希望在显示器的正中显示该盒子,其实就是这么简单的一段代码,还有使用传统的方式来实现居中的,有时间写写