uppercase converts every letter to its capital form, lowercase converts every letter to lowercase, and capitalize capitalizes just the first letter of each word, leaving the rest of each word's original casing otherwise untouched — critically, this transformation is purely visual/presentational, applied at render time, meaning the actual text content in the HTML source, and therefore what a screen reader announces, what gets copied to the clipboard, or what JavaScript reads from the element, remains completely unchanged and unaffected by the CSS transformation.
1Understanding Text-transform
uppercase converts every letter to its capital form, lowercase converts every letter to lowercase, and capitalize capitalizes just the first letter of each word, leaving the rest of each word's original casing otherwise untouched — critically, this transformation is purely visual/presentational, applied at render time, meaning the actual text content in the HTML source, and therefore what a screen reader announces, what gets copied to the clipboard, or what JavaScript reads from the element, remains completely unchanged and unaffected by the CSS transformation.
Remember text-transform only changes how text visually displays — copying visually-uppercase text still copies the original, unmodified underlying text, and a screen reader typically still announces the actual underlying casing, not the CSS-transformed visual appearance.
.button-label {
text-transform: uppercase;
}
<button class="button-label">submit</button>2Practical Example
Here is a real-world application of Text-transform showing how it is used in production CSS code.
.title {
text-transform: capitalize;
}
<h2 class="title">hello world</h2>3Best Practices
Follow these guidelines when working with Text-transform:
1. Use text-transform: uppercase for stylistic, all-caps display text, like button labels or section headings, rather than manually typing the content in all caps in the HTML itself
2. Rely on text-transform specifically because it preserves the original underlying text content, keeping the actual HTML source in normal, natural casing for readability and semantic correctness
3. Avoid assuming text-transform affects anything beyond visual rendering — don't rely on it for anything that needs the actual text content itself to be a particular case, like a case-sensitive comparison in JavaScript
Tip: Remember text-transform only changes how text visually displays — copying visually-uppercase text still copies the original, unmodified underlying text, and a screen reader typically still announces the actual underlying casing, not the CSS-transformed visual appearance.
.button-label {
text-transform: uppercase;
}
<button class="button-label">submit</button>