CSS Reference ยท Typography
The text-transform property
Reference for the CSS text-transform property: uppercase, lowercase, capitalize and full-width, how it affects the display only, and accessibility notes.
The text-transform property changes how letters are displayed: all capitals, all lowercase, or a capital at the start of each word. It only changes the rendering. The underlying text in the HTML stays the same, which means copied text, search and the DOM can differ from what you see.
.badge { text-transform: uppercase; }
Try it
Notice that capitalize leaves "QUICK" as it is: it raises the first letter of each word but does not lower the others.
Syntax
text-transform: none | capitalize | uppercase | lowercase | full-width | full-size-kana;
- Initial value:
none - Applies to: all elements; also
::first-letterand::first-line - Inherited: yes
- Animatable: no
- Computed value: as specified
Values
| Value | Description |
|---|---|
none |
No change. |
capitalize |
Puts the first letter of each word in uppercase. Other letters are left unchanged. |
uppercase |
Displays all letters in uppercase. |
lowercase |
Displays all letters in lowercase. |
full-width |
Converts characters to their full-width forms, mainly for East Asian typography. Limited support; check a compatibility table. |
full-size-kana |
Converts small kana to full-size kana, used for ruby annotations. Limited support; check a compatibility table. |
Usage notes
- Display only. The text in the DOM is untouched. Users who copy the text may get the original case, depending on the browser.
- Prefer CSS to retyping. Writing "SAVE" in HTML instead of using
uppercasemakes some screen readers spell it out letter by letter. Writing normal text and transforming it with CSS is usually better, though screen reader behavior varies. capitalizeis not title case. It does not skip small words like "of" or "the", and it does not lowercase the rest. It also treats punctuation and hyphenation in locale-dependent ways.- Language matters. Set the
langattribute so the browser applies the right rules, for example Turkish dotted and dotless i. Some letters expand: German "ร" can become "SS" in uppercase. - Long uppercase text is tiring to read. Reserve it for short labels, and add a little
letter-spacing. - Small capitals are a different feature: see
font-variant-caps.
Browser support
none, capitalize, uppercase and lowercase work in every browser. full-width and full-size-kana have uneven support, so check a compatibility table.
Related
font-variant-capsโ real small capitalsletter-spacingโ tracking for uppercase textfont-weightโ boldness- Lesson: Styling Text