gpt4 book ai didi

css - 在不影响占位符的情况下在 CSS 中将输入值设为大写

转载 作者:数据小太阳 更新时间:2023-10-29 09:11:13 24 4
gpt4 key购买 nike

有没有一种方法可以使输入值大写而不使占位符大写?

似乎我得到了一个或另一个。我宁愿只使用 CSS(最后的 JS 手段)干净利落地做到这一点。

enter image description here

最佳答案

每个浏览器引擎都有不同的实现来控制 placeholder 样式。使用以下内容:

jsBin example.

input { 
text-transform: uppercase;
}
::-webkit-input-placeholder { /* WebKit browsers */
text-transform: none;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
text-transform: none;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
text-transform: none;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
text-transform: none;
}
::placeholder { /* Recent browsers */
text-transform: none;
}

不用说,这只适用于可以处理占位符的浏览器。 (IE9/10+)

关于css - 在不影响占位符的情况下在 CSS 中将输入值设为大写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25180140/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com