右边根据左边的高度自动居中只需要两行CSS就可以完成
<style type="text/css" >
div{
display: inline-block;
vertical-align:middle;
}
.div1{
height:500px;
width:500px;
background:pink;
}
.div2{
width:200px;
height:20px;
background: #c7254e;
margin-left:50px;
}
</style>
<div>
<div class="div1"></div>
<div class="div2"></div>
</div>
更多专业前端知识,请上【猿2048】www.mk2048.com
来源:https://blog.csdn.net/qq_45670012/article/details/102777587