{"id":144460,"date":"2013-07-24T19:35:21","date_gmt":"2013-07-25T02:35:21","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=144460"},"modified":"2015-02-04T09:33:16","modified_gmt":"2015-02-04T16:33:16","slug":"text-transform","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/t\/text-transform\/","title":{"rendered":"text-transform"},"content":{"rendered":"
The The demo below shows See the Pen 0f4293fce0d14aafc3818c950ab0ded3<\/a> by mariemosley (@mariemosley<\/a>) on CodePen<\/a>.<\/p>\n 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()<\/a>.<\/p>\ntext-transform<\/code> property in CSS controls text case and capitalization. <\/p>\n
.lowercase {\r\n text-transform: lowercase;\r\n }<\/code><\/pre>\n
Text-Transform Values<\/h3>\n
\n
lowercase<\/code> makes all of the letters in the selected text lowercase.<\/li>\n
uppercase<\/code> makes all of the letters in the selected text uppercase.<\/li>\n
capitalize<\/code> capitalizes the first letter of each word in the selected text. <\/li>\n
none<\/code> leaves the text’s case and capitalization exactly as it was entered.<\/li>\n
inherit<\/code> gives the text the case and capitalization of its parent.<\/li>\n<\/ul>\n
lowercase<\/code>,
uppercase<\/code>, and
capitalize<\/code> 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.<\/p>\n
Points of Interest<\/h3>\n
capitalize<\/code> 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”.<\/p>\n
capitalize<\/code> 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<\/code> 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.<\/p>\n
Related Properties<\/h3>\n
\n
More Information<\/h3>\n
\n
Browser Support<\/h3>\n