transform垂直居中

by gothic

HTML

<div>
<p>heloo</p></div>

CSS

div {height: 50px;}
p {
    background:blue;
    position:relative;
    top: 50%;
    transform: translateY(-50%)
}