to vertically align any element, you can utilize the position: absolute;
CSS property
for instance,
HTML
<div class="parent">
<div class="element">I'm always<br/>In<br>Center</div>
</div>
CSS
.parent {
height: 100%;
}
.element {
position:absolute;
top:50%;
left: 0;
transform: translateY(-50%);
}
.parent {
height: 100%;
}
.element {
position:absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
}
<div class="parent">
<div class="element">I'm always<br/>In<br>Center</div>
</div>
OR
employing display: table-cell;
HTML
<div class="container">
<div class="content">I'm always<br/>In<br>Center</div>
</div>
CSS
html, body {
width: 100%;
height: 100%;
display: table;
}
.container {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.content {
background-color: #dddddd;
display: inline-block;
text-align: center;
padding: 5px;
width:200px;
}
LIVE SNIPPET
html, body {
width: 100%;
height: 100%;
display: table;
}
.container {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.content {
background-color: #dddddd;
display: inline-block;
text-align: center;
padding: 5px;
width:200px;
}
<div class="container">
<div class="content">I'm always<br/>In<br>Center</div>
</div>