how to vertically align text in a div code example
Example 1: css align center
//HTML
<div class="parent">
<span>Hello World</span>
</div>
//CSS
.parent {
display: flex;
justify-content: center;
align-items: center;
}
Example 2: css align items vertical center
.parent {
display: flex;
justify-content: center;
align-items: center;
}
Example 3: css align text vertically
<div class="text">
lorem ipsum
</div>
.text {
vertical-align: middle;
}
Example 4: css align center vertical and horizontal
.parent-class {
display: flex;
align-items: center;
justify-content: space-around;
}
Example 5: how to make the text vertically centered in css
div{
position: relative;
top: 25%;
bottom: 25%;
}
Example 6: vertical align center text inside div
.center {
height: 309px;
line-height: 309px;
}