text-transform: capitalize; Also affects Placehold

2019-03-22 18:59发布

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条回答
可以哭但决不认输i
2楼-- · 2019-03-22 19:31

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;
}
查看更多
登录 后发表回答