Home > AI > Language > CSS >

text-align

<body>
    <p class="text-left">Left-aligned text</p>
    <p class="text-right">Right-aligned text</p>
    <p class="text-center">Center-aligned text</p>

    <style>
        .text-left {
            text-align: left;
            background-color: blue;
            color: white;
        }
        .text-right {
            text-align: right;
            background-color: red;
            color: white;
        }
        .text-center {
            text-align: center;
            background-color: orange;
            color: white;
        }
    </style>
</body>

Leave a Reply