css常用样式 上下左右置中对齐 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #id { position: absolute; top:50%; left:50%; transform: translateX(-50%) translateY(-50%); } body { min-height: 100vh; display: flex; justify-content: center; align-items: center; } text-align: justify; /*文字对其*/ 闭合浮动 1 2 3 4 5 6 7 8 9 10 11 .class{ overflow:hidden; } .class{ display:flow-root; } .class::after{ content:''; clear:both; display:block; }