text-transform

Avatar of Chris Coyier
Chris Coyier on (Updated on )

UGURUS offers elite coaching and mentorship for agency owners looking to grow. Start with the free Agency Accelerator today.

The text-transform property in CSS controls text case and capitalization.

.lowercase {
  text-transform: lowercase;
  }

Text-Transform Values

  • lowercase makes all of the letters in the selected text lowercase.
  • uppercase makes all of the letters in the selected text uppercase.
  • capitalize capitalizes the first letter of each word in the selected text.
  • none leaves the text’s case and capitalization exactly as it was entered.
  • inherit gives the text the case and capitalization of its parent.

The demo below shows lowercase, uppercase, and capitalize in use. Take a look at the HTML tab to see how the text was originally written, then switch back to the results tab to see it after the CSS is applied.

See the Pen 0f4293fce0d14aafc3818c950ab0ded3 by mariemosley (@mariemosley) on CodePen.

Points of Interest

capitalize will capitalize words that appear inside single or double quotes, and the first letter after a hyphen. It won’t capitalize the first letter after a number, so dates like “February 4th, 2015” won’t transform into “February 4Th, 2015”.

capitalize only affects the first letters of words. It will not change the case of the rest of the letters in a word. For example, if you capitalize a word that’s in all capital letters already, the other letters in the word won’t switch to lowercase. This is nice when your text includes an acronym or abbreviation that shouldn’t include any lowercase letters.

CSS can’t do “title case”, the capitalization style used in titles of books, movies, songs, and poems, where articles are lowercase (as in “Raiders of the Lost Ark”). But, there are JavaScript solutions for title case, including David Gouch’s toTitleCase().

Related Properties

More Information

Browser Support

Chrome Safari Firefox Opera IE Android iOS
Any Any Any Any Any Any Any

Firefox supports language-specific capitalization rules for Turkic languages, German, Dutch, and Greek that are not supported by other browsers. Firefox is also the only browser that supports text-transform: full-width;, which can help improve the readability of text that includes a mixture of latin and East Asian scripts. See details at MDN.