text-transform z1l60
The text-transform property specifies how words or individual letters are displayed in capital letters. y5k14
It can be used to display text in all-uppercase letters, all-lowercase, or to capitalize words (make first letter of each word a capital letter).
Official Syntax 4j1l4a
- Syntax:
text-transform: none | capitalize | uppercase | lowercase | full-width
- Initial: none
- Applies To: all elements
- Animatable: no
Values 4w6m73
- none
- No effect is applied to the text. It prevents any change to the case of the characters.
- capitalize
- Converts the first letter of each word to uppercase. Other letters in each word are not affected, they retain their original case (whether upper or lower) as written in the element’s text source.
- uppercase
- forces all letters to uppercase.
- lowercase
- forces all letters to lowercase.
- full-width
-
Forces the writing of a character, mainly ideograms and Latin scripts inside a square, allowing them to be aligned in the usual East Asian scripts (like Chinese or Japanese).
Some characters exists in two formats, normal width and a full-width, with different Unicode code points. The full-width version is used to mix them smoothly with Asian ideographic characters. If the character does not have a corresponding full width form, it is left as is.
Notes 5i3os
The text-transform
property cascades, so you may want or need to reset its value (set it to none
) on an element’s child to prevent the text inside that child from being affected by the transformation of its parent.
Examples 3y6d6i
The following forces all the h1
elements to be displayed in all-uppercase letters.
h1 { text-transform: uppercase; }
The following will capitalize each word in all the h2
tags.
h2 { text-transform: capitalize; }
Live Demo 176n59
View this demo on the Codrops PlaygroundBrowser s162l
The text-transform
property is ed in all major browsers: Chrome, Firefox, Safari, Opera, IE and on Android and iOS.
Notes 5i3os
The full-width
value is only ed in Firefox at this time starting from version 19.0.
The CSS Text Level Module 4 adds a new value full-size-kana
which is still experimental and not yet ed by any browser.