Support0

CSS text-transform playground

Explore text-transform with a selector for changing visual capitalization without editing the HTML content.

Ask AI

CSS text-transform playground

Response generated with openai/gpt-5.4-nano. AI can make mistakes. Always review the result.

BaselineLab CSS text-transform mixed CASE, spanish accents, words-with-hyphens and 2026 labels. capitalize changes each word; uppercase and lowercase transform every cased letter.

HTML
<p class="text-transform-sample">
  BaselineLab CSS text-transform
  mixed CASE, spanish accents, words-with-hyphens and 2026 labels.
  capitalize changes each word; uppercase and lowercase transform every cased letter.
</p>
Tailwind CSS
Examples for Tailwind CSS 4.3 with the default theme. Custom values keep arbitrary classes when there is no equivalent utility. Changing the theme can change utility values.
<p class="max-w-2xl text-3xl font-bold leading-tight normal-case">
  BaselineLab CSS text-transform
  mixed CASE, spanish accents, words-with-hyphens and 2026 labels.
  capitalize changes each word; uppercase and lowercase transform every cased letter.
</p>
CSS
.text-transform-sample {
  max-inline-size: 42rem;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: none;
}

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.

  1. Original content

    Write names, acronyms, and sentences with correct casing in HTML. CSS should not be needed to recover their meaning.

  2. Rule and language

    The CSS value selects the transformation; lang identifies the text’s language and inherits when not declared on the element itself.

  3. Presented text

    The appearance can change in width and even the number of visible letters. A visual transformation does not add semantic emphasis.

Static diagram of a visual changeContent keeps its original spelling. The browser chooses visible forms according to the transformation and language, and lays out lines again if their width changes.

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.

All four paragraphs contain exactly the same text in HTML. capitalize preserves CSS and BaselineLab’s internal capitals; uppercase and lowercase also change those letters. Numbers and punctuation remain. none provides the original for comparison.
The same content, four presentations
<div class="text-transform-guide-values" lang="en">
  <div>
    <p class="label">text-transform: none</p>
    <p class="sample none">learn CSS with BaselineLab: action and 2026.</p>
  </div>
  <div>
    <p class="label">text-transform: capitalize</p>
    <p class="sample capitalize">learn CSS with BaselineLab: action and 2026.</p>
  </div>
  <div>
    <p class="label">text-transform: uppercase</p>
    <p class="sample uppercase">learn CSS with BaselineLab: action and 2026.</p>
  </div>
  <div>
    <p class="label">text-transform: lowercase</p>
    <p class="sample lowercase">learn CSS with BaselineLab: action and 2026.</p>
  </div>
</div>
.text-transform-guide-values {
  display: grid;
  gap: 1rem;
  overflow-wrap: anywhere;

  .label {
    margin-block: 0 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
  }

  .sample {
    max-inline-size: 36ch;
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.6;
  }

  .none {
    text-transform: none;
  }

  .capitalize {
    text-transform: capitalize;
  }

  .uppercase {
    text-transform: uppercase;
  }

  .lowercase {
    text-transform: lowercase;
  }
}

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

The Turkish row shows İSTANBUL İZMİR IŞIK; the English row shows ISTANBUL IZMIR IŞIK. The second is a comparison control with another lang, not the correct language label for that Turkish text. The German sample shows STRASSE while its HTML keeps straße.
The same i with two language rules
<div class="text-transform-guide-language">
  <div>
    <p class="label">lang="tr" · uppercase</p>
    <p class="sample" lang="tr">istanbul izmir ışık</p>
  </div>
  <div>
    <p class="label">lang="en" · uppercase</p>
    <p class="sample" lang="en">istanbul izmir ışık</p>
  </div>
  <div>
    <p class="label">lang="de" · uppercase</p>
    <p class="sample" lang="de">straße</p>
  </div>
</div>
.text-transform-guide-language {
  display: grid;
  gap: 1rem;
  overflow-wrap: anywhere;

  .label {
    margin-block: 0 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
  }

  .sample {
    max-inline-size: 36ch;
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.6;
  }

  .sample {
    text-transform: uppercase;
  }
}

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

The status inherits uppercase from the container. The span with none preserves BaselineLab, iPhone, and CSS as written in HTML. There is no second hidden text or accessible label duplicating it.
Transform the status and preserve the name
<div class="text-transform-guide-scope" lang="en">
  <p class="sample">Project available: <span class="identity">BaselineLab · iPhone · CSS</span></p>
</div>
.text-transform-guide-scope {
  max-inline-size: 36ch;
  overflow-wrap: anywhere;
  text-transform: uppercase;

  .sample {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.6;
  }

  .identity {
    text-transform: none;
  }
}

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.