实现效果如下所示:
实现的最终代码:
css部分设置:
*{
margin: 0px;
padding: 0px;
}
.box{
width: 500px;
height: 300px;
border: 1px solid black;
background-color: cornflowerblue;
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
margin: auto;
}
span{
display: inline-block;
/* /* width: 100%; */
/* width: 50%; */
height: 100px;
vertical-align: middle;
text-align: center;
line-height: 100px;
margin-top: 100px;
background: linear-gradie