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 63 times
1

Joey Yi Zhao
- 37,514
- 71
- 268
- 523
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,669
- 2
- 22
- 32
-
It's there a more direct way? – Sep 27 '18 at 03:02