Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to un-capitalize text with CSS, and then re-capitalize it?

Tags:

css

I have a piece of text coming to me from an external source that is ALL CAPS. I want it to be simply capitalized at the first letter. Seems that text-transform:capitalize won't uncapitalize the rest of the word. Any way to do this without JS?

like image 827
Plum Pie Avatar asked Jan 21 '23 12:01

Plum Pie


2 Answers

Something like this? http://jsbin.com/agocu3/2

css

   p { text-transform: lowercase;}
   p:first-letter {text-transform:capitalize}

html

<p>YOUR TEXT GOES HERE</p>
like image 65
Sotiris Avatar answered May 01 '23 23:05

Sotiris


You can put the text in lowercase and then use the pseudo selector :first-letter to uppercase the first letter

p {
    text-transform: lowercase;
}

p:first-letter {
    text-transform: uppercase;
}
like image 21
nunopolonia Avatar answered May 02 '23 00:05

nunopolonia