CHAPTER 14

CSS Text

Learn how to control text color, alignment, decoration, spacing and other text properties.

01. What is CSS Text?

CSS provides many properties for controlling the appearance of text.
You can change alignment, decoration, indentation, spacing and transformation.
Text styling is important for readable and attractive websites.

02. Syntax

selector { color: value; text-align: value; text-decoration: value; text-transform: value; }

03. Example

CSS / HTML Example AIFA Coding Lab
<!DOCTYPE html>
<html>
<head>

<style>

h1 {

    color: #2563eb;

    text-align: center;

    text-transform: uppercase;

}

p {

    color: #475569;

    line-height: 1.8;

    letter-spacing: 1px;

}

</style>

</head>

<body>

<h1>AIFA Infotech</h1>

<p>
Learn professional web development.
</p>

</body>
</html>

04. Important Points

✓ color changes text color.
✓ text-align controls horizontal alignment.
✓ text-decoration controls underline and other decorations.
✓ text-transform controls uppercase and lowercase transformation.
✓ line-height improves readability.

05. Common Mistakes

⚠ Using very small text sizes.
⚠ Using low contrast text colors.
⚠ Adding excessive letter spacing.
⚠ Using text alignment that reduces readability.

06. Real World Use

Text properties are used throughout websites for headings, paragraphs, navigation menus, buttons and content sections.

Ready to Practice? 🚀

Open the AIFA CSS Editor and practice this chapter live.

Try It Yourself →
Practice Exercise

Style a Heading and Paragraph

Create a heading with center alignment and uppercase text. Add a paragraph with custom color and line-height.