table 布局

5年以前  |  阅读数:642 次  |  编程语言:HTML/CSS 
// 给容器元素设置display: table,当前元素设置display: table-cell:

.container {
  width: 300px;
  height: 200px;
  border: 1px solid #333333;
  display: table;
}
.content {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
}

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8