text-transform: capitalize; Also affects Placeholder

社会主义新天地 提交于 2019-12-09 07:44:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!