p标签在div中垂直居中,并且div高度随着p标签文字内容的变化而变化 1.div设置flex布局 div{ display: flex; align-items: center; } 2.div不要设置height,设置min-height