[Solved] How to Vertical align text in div


I have 2 solutions:

1- Use display:table-cell; vertical-align: middle

2- Use position:absolute; transform:translateY(-50%);top:50%

.relative{position:relative;height:300px}
.middle{position:absolute;top:50%;transform:translateY(-50%)}
<div class="relative">
<div class="middle">
<h1>Middle</h1>
</div>
</div>

solved How to Vertical align text in div