将所有大写字母转换为首字母大写
我想知道是否有任何方法仅使用CSS(这可以是浏览器特定的CSS)将所有大写文本转换为仅最初大写的单词,例如:
I YELL WITH MY KEYBOARD
将是转换为:
我用键盘大喊
编辑:我意识到我的问题不够清楚,输入的文本是大写的,而不是最初小写的,文本转换:大写不适用于数据看起来是这样输入的。
I was wondering if there was any way using only CSS, (and this CAN be browser specific CSS) to convert all uppercase text to words that are only initially capitalized for example:
I YELL WITH MY KEYBOARD
would be converted to:
I Yell With My Keyboard
EDIT: I realized I wasn't clear enough in my question, the text was entered capitalized, not initially lowercase, text-transform: capitalize doesn't work on data that has been entered like this it seems.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 CSS 进行一些文本转换操作,以下是所有这些操作。
不幸的是,没有驼峰式文本转换。
您始终可以使用 Javascript 来适当地转换文本,或者如果您使用的是 PHP 或 ASP 等脚本语言,则可以在其中进行更改。
以下是取自 strtoupper PHP 文档页面的示例:
There's a few things you can do with CSS for text transformations, here's all of them.
Unfortunately there is no Camel Case text-transform.
You could always use Javascript to transform the text appropriately or if you are using a scripting language such as PHP or ASP then change it in there.
Here's an example taken from the strtoupper PHP doc page: