By definition, text-transform: capitalize capitalizes the first letter of each word in the selected text. But it only works for the lowercase text. My text is all uppercase, how can I use css text-transform to make the first letter uppercase and other letters lowercase?
Asked
Active
Viewed 56 times
1
Joey Yi Zhao
- 30,508
- 51
- 183
- 377
1 Answers
0
::first-letter can be used to select the first letter from the first line of block-level elements.
p {
text-transform: lowercase;
}
p::first-letter {
color: red;
text-transform: capitalize;
}
<p class="capitalize">lowercase</p>
<p class="capitalize">UPPERCASE</p>
Arman Charan
- 5,235
- 2
- 21
- 31
-
It's there a more direct way? – Sep 27 '18 at 03:02