how to center text using css 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: center text in css
.class {
text-align: center;
}
Example 3: css text align center
/* Character-based alignment in a table column */
text-align: center;
/* The inline contents are centered within the line box. */
Example 4: css text align center
body {
text-align: center;
}
Example 5: css text align right
body {
text-align: right;
}