</> Code Corner

CSS · CSS Tutorial · Lesson 14

CSS Text

Alignment, decoration, transformation and spacing.

CSS has many properties for formatting text.

Example

<style>
h1 { text-align: center; text-transform: uppercase; letter-spacing: 3px; }
p.a { text-decoration: underline wavy red; }
p.b { line-height: 1.8; text-indent: 40px; word-spacing: 6px; }
p.c { text-shadow: 2px 2px 4px #999; }
</style>
<h1>Text formatting</h1>
<p class="a">Underlined with a wavy line.</p>
<p class="b">This paragraph has a larger line height, an indented first line, and extra spacing between words so it is easier to read.</p>
<p class="c">Text with a shadow.</p>
Property Use
color Text color
text-align left, right, center, justify
text-decoration underline, overline, line-through, none
text-transform uppercase, lowercase, capitalize
letter-spacing / word-spacing Space between characters / words
line-height Space between lines
text-shadow Shadow behind text

Keep reading “CSS Text”

Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.

Chat with us 👋