问题
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?
回答1:
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;
}
来源:https://stackoverflow.com/questions/22415038/text-transform-capitalize-also-affects-placeholder