下面是子元素样式,父元素设置position relative,以及固定宽高
水平居中
position:'absolute',
top:-10,
height: 40,
marginLeft:-110,//值为width一半
width:220,
left:'50%',在这里插入代码片
水平居中垂直居中
position:'absolute',
top:-10,
height: 40,
marginLeft:-110,//值为width一半
marginTop:-20,//值为height一半
top:50%,
width:220,
left:'50%',在这里插入代码片