我希望我的标题字母占位符(例如——请输入您的护照号码),我的条目全部为大写字母。它还包含一些数字。 我试过这个:Make input value uppercase in CSS without affecting the placeholder 但是当我尝试这个解决方案时,我页面上的所有条目都是大写的。我只想要一个大写的特定条目。
最佳答案
也许使用类
...
input.separate {
text-transform: uppercase;
width: 300px;
height: 35px;
padding: 0 5px;
margin: 5px 0;
}
input {
text-transform: none;
width: 300px;
height: 35px;
padding: 0 5px;
}
::-webkit-input-placeholder { /* WebKit browsers */
text-transform: capitalize;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
text-transform: capitalize;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
text-transform: capitalize;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
text-transform: capitalize;
}
<input class="separate" type="text" placeholder="please enter your passport number" />
<input type="text" placeholder="please enter your passport number" />
关于css - 如何在不影响占位符的情况下在文本框中输入大写字母?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48237623/