1

Hello guys I am try to get only the first letter on this input element as upper case input::first-letter is not recognize, only input{text-transform: uppercase;}

and I try to achieve only value be Hello world how can I implement it on CSS only?

*that issue happened only on input element

input::first-letter {
  text-transform: uppercase;
}
<input type="text" name="name" value="hello world">

https://codepen.io/lichaytiram/pen/JjWmqxo

Lichay Tiram
  • 283
  • 3
  • 12

1 Answers1

1

According to MDN - ::first-letter

The ::first-letter CSS pseudo-element applies styles to the first letter of the first line of a block-level element.

<input> is not a block level element. For example you can see it working for a <p> element, which is block-level

input {
  display: block; /* still doesn't work */
}

p::first-letter,
input::first-letter {
  text-transform: uppercase;
}
<input type="text" name="name" value="hello world">
<p>hello world</p>
T J
  • 42,762
  • 13
  • 83
  • 138