CSS ยท Module 17 ยท Lesson 20 of 48

Text Transformations & Decorations

What are Text Transformations & Decorations?

Imagine using a highlighter to underline important terms in a textbook, or using a stamps kit to automatically capitalize every letter of a name on a form.

In CSS, we apply stylistic overrides to characters using:

  • text-decoration: Adds line styles like underline, line-through (strike-through), or none (commonly used to strip default underlines from anchor link elements).
  • text-transform: Automatically converts letter casing to uppercase, lowercase, or capitalize (capitalizes the first letter of every word) without modifying the actual text in your HTML.
  • Why does it matter?

    Text decorations and transformations separate design style from content data. For example, instead of typing headers in all caps in your HTML (like <h1>WELCOME</h1>), you can type them normally and write text-transform: uppercase; in CSS. This keeps search engines happy while maintaining your design aesthetics.

    Syntax Breakdown

  • text-decoration: underline; โ€” Underlines characters.
  • text-decoration: none; โ€” Clears default underlines.
  • text-transform: uppercase; โ€” Converts all characters to uppercase.
  • text-transform: capitalize; โ€” Capitalizes first letter of words.
  • Common Mistakes

  • Underlining non-link text: Users expect underlined text to be clickable links. Underlining normal paragraph text for emphasis confuses visitors. Use font-weight: bold; or font-style: italic; instead!
  • Quick Reference

  • text-decoration โ€” Underlines, overlines, or strikes through text.
  • text-transform โ€” Enforces capitalization standards dynamically.
  • letter-spacing โ€” Controls spacing between individual letters.
  • Your Task
    Set the `text-decoration` property of the `a` selector to `none` to remove the default link underline.
    index.html
    Type code above to start the lesson.
    Live Preview