text-align

The text-align CSS property describes how inline content like text is aligned in its parent block element. text-align does not control the alignment of block elements itself, only their inline content.

Syntax

text-align: left
text-align: right
text-align: center
text-align: justify
text-align: start
text-align: end
text-align: match-parent
text-align: start end
text-align: “.”
text-align: start “.”
text-align: “.” end

text-align: inherit

<!doctype html>
<html>
    <head>
        <title>:target pseudoclass example</title>
        <style type="text/css">
            .p1 {
                text-align: center;
            } .p2 {
                text-align: right;
            }
        </style>
    </head>
    <body>
        <p class="p1">
            The quick brown red fox jumps over the lazy dog
        </p>
        <p class="p2">
            The quick brown red fox jumps over the lazy dog
        </p>
    </body>
</html>