I have the following simple input.
<input type="text" placeholder="What is your username?" />
When I use text-transform: capitalize;
to capitalize the first letter of each word, the placeholder also gets capitalized: What Is Your Username?
How can I keep the placeholder intact?
The text-transform property controls capitalization effects of an element's text.
Placeholder styles will not resize an input field and will not affect its box model. Add font-size to your input to fix the placeholder from getting cut off. You also might consider adding placeholder styles for other browsers...
The “placeholder” property is used to get or set the placeholder of an input text. This can be used to change the placeholder text to a new one. The element is first selected using a jQuery selector. The new placeholder text can then be assigned to the element's placeholder property.
<input type="text" placeholder="A red placeholder text..">
You could style the placeholder--
::-webkit-input-placeholder { text-transform: initial; } :-moz-placeholder { text-transform: initial; } ::-moz-placeholder { text-transform: initial; } :-ms-input-placeholder { text-transform: initial; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With