Educational guide to text-transform
Change presentation without rewriting the text
Compare uppercase, lowercase, and word beginnings. Preserve the original content, declare its language, and limit transformation to text where it helps reading.
Mental model
text-transform changes letter presentation, not the original DOM content. It inherits and its initial value is none. It serves a visual decision; it does not correct names, translate text, or normalize form data.
- Original content
Write names, acronyms, and sentences with correct casing in HTML. CSS should not be needed to recover their meaning.
- Rule and language
The CSS value selects the transformation; lang identifies the text’s language and inherits when not declared on the element itself.
- Presented text
The appearance can change in width and even the number of visible letters. A visual transformation does not add semantic emphasis.
The playground’s four values
capitalize changes each word’s beginning and preserves other letters. It does not first lowercase everything or generate titles using editorial rules. uppercase transforms to capitals; lowercase to lowercase letters; none stops applying transformation and shows the original casing.
The same content, four presentations
text-transform: none
learn CSS with BaselineLab: action and 2026.
text-transform: capitalize
learn CSS with BaselineLab: action and 2026.
text-transform: uppercase
learn CSS with BaselineLab: action and 2026.
text-transform: lowercase
learn CSS with BaselineLab: action and 2026.
Do not use capitalize to correct proper names or turn ALL UPPERCASE text into a title. It does not know which words an editorial style leaves lowercase either. Keep that spelling in the content. This differs from font-variant-caps: small-caps requests typographic forms from the font, rather than this case conversion.
Language is part of the result
lang does not translate content: it declares how it should be interpreted. In Turkish, i pairs with İ and ı with I. The same text with a different declared language can produce different capitals. Conversion can also change the number of presented characters, such as German ß to SS.
The same i with two language rules
lang="tr" · uppercase
istanbul izmir ışık
lang="en" · uppercase
istanbul izmir ışık
lang="de" · uppercase
straße
Declare the real language on html and change lang locally when a fragment uses another language. Do not change lang merely to force an appearance. Support for particular rules varies: for example, Dutch ij with capitalize differs between engines. CSS.supports can confirm the uppercase value, but not that every linguistic rule is applied correctly.
Inheritance, none, and readability
A rule on a container inherits into its descendants. Use a limited selector and none where names or brands should keep their original casing. none does not apply an inverse conversion or reconstruct letters already changed in the data.
Transform the status and preserve the name
Project available: BaselineLab · iPhone · CSS
Reserve visual capitals for short labels when they add clarity; long blocks can be harder to read. Use strong or em for meaningful emphasis. Do not infer pronunciation or spelling from appearance: check the actual language, browser, and assistive technology. Let text grow and wrap, as capitals can take more width.
Common pitfalls
capitalize preserves letters I expected to lowercase
- Expected result
- Only each word’s beginning is transformed.
- Cause
- capitalize keeps other letters and does not apply editorial title rules or a preliminary lowercase conversion.
- Solution
- Store correct casing in the content and use CSS only for a limited visual decision.
What I see is not my data’s value
- Expected result
- Content and values remain the originals.
- Cause
- text-transform acts on presentation. A field’s or paragraph’s appearance does not prove that its data was converted.
- Solution
- If the application needs to transform data, do so explicitly with appropriate language rules. The specification calls for preserving the original in plain text copying; check actual behavior and do not use appearance as a clipboard contract.
A letter changes in an unexpected way
- Expected result
- Presentation respects the fragment’s language.
- Cause
- lang is missing, another language inherits, or the engine does not implement a particular linguistic rule.
- Solution
- Declare the actual language and test the required texts in target browsers. If exact spelling is essential, put it correctly in the content.
Support and compatibility
none, capitalize, uppercase, and lowercase have widely established support. This does not guarantee every language rule or other draft values. The guide covers the playground’s four values, with native examples on regular elements.
These values do not need a polyfill. Without the declaration, text keeps its original casing and should remain understandable. The scenes work without JavaScript. The general Baseline status does not certify pronunciation, plain text copying, particular language rules, or identical typesetting across fonts and engines.