简单的使div中的div居中的方法

#parent { 
  text-align: center; /* 因为子元素设置为行内元素,因此可以用文本对齐属性来居中 */
}

#child {
  display: inline-block;
} 

你可能感兴趣的:(笔记)