方法3,弹性盒模型

.box {/* 大盒子 */
  width: 400px;
  height: 400px;
  background: #Ccc;
  display: flex;
  justify-content: center;//水平居中
  align-items: center;//垂直居中
}

.box1 {/* 小盒子 */
  width: 200px;
  height: 100px;
  background: red;
}
posted @ 2018-09-25 15:30  指尖下的幽魂  阅读(193)  评论(0编辑  收藏  举报