1

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?

Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523

1 Answers1

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