css text align middle code example
Example 1: css align center
<div class="parent">
<span>Hello World</span>
</div>
.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: centering css elements
.parent {
display: grid;
place-items: center;
}
Example 4: css center text
.centerText {
text-align: center;
}
Example 5: middle text css
text-align: center;
Example 6: center text css
p {
text-align: center;
}