CSS
1. 块级元素和行内元素的水平和垂直居中问题
(1)块级元素水平居中
1)width:200px;margin:0 auto;
2)width:200px; position:flex; left:0;right:0;margin: auto;
3)弹性布局:{
父元素:display:flex;
子元素:margin: 0 auto;
}
(2)块级元素垂直居中
1)height:200px;position:flex;top:0;bottoom:0;margin:auto;
2)弹性布局:{
父元素:display:flex;height:200px;
子元素:margin:auto;
}
(3)行内元素水平居中
父元素:text-align:center
(4)行内元素垂直居中
父元素:height = line-height