前言
提示:垂直居中的方式:
我们设置样式的居中方式
一、行内元素的居中?
父级元素中加text-align,line-height; 在css中,以font- text- line- 开头的都具有继承性,对行内元素和行内块,是很有效。
.box {
width: 200px;
height: 200px;
background-color: burlywood;
/* span的父级添加text-align:center;line-height */
text-align: center;
line-height: 200px;
}
span {
color: black;
font-weight: bold;
}
<div class=