📜  居中对齐 div 垂直和水平 css 代码示例

📅  最后修改于: 2022-03-11 14:47:28.908000             🧑  作者: Mango

代码示例4
.center {
  height: 200px;
  position: relative;
  border: 3px solid green;
}

.center p {
  margin: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}