codegurukool.com · Free coding tutorials & online compiler

Home › CSS Tutorial › CSS text

CSS text

Align, decorate and space text.

Key properties: text-align, text-decoration, text-transform, letter-spacing, line-height, text-indent.

Commands in this lesson

text-align

Definition: Aligns text horizontally.

Syntax:

text-align: left | center | right;

Example:

text-align: center;

Example code

<style>
h2{text-align:center;text-transform:uppercase;letter-spacing:3px}
p{text-indent:30px;line-height:1.8;text-decoration:underline wavy teal}
</style>
<h2>Title</h2><p>Some body text to style.</p>

Run this code in the online editor

← CSS outlineCSS fonts →