在Sentence中使用CSS将大写字母转换为小写字母和第一个大写 [英] Convert Uppercase Letter to Lowercase and First Uppercase in Sentence using CSS
问题描述
如何将UPPERCASE字母转换为小写字母和第一个字母大写字母为每个句子如下仅通过使用CSS?
How to convert UPPERCASE letter to lowercase and first letter Uppercase for each sentences like below only by using CSS?
从:
这是示例注释。
From: THIS IS AN EXAMPLE SENTENCE.
strong> To:
这是一个例句。
To: This is an example sentence.
更新:使用文本转换:大写;
结果仍然相同。
Update: When I'm using text-transform: capitalize; The result still same.
推荐答案
CSS中没有句柄选项。其他回答建议 text-transform:capitalize
不正确,因为该选项会大写每个字。
There is no sentence caps option in CSS. The other answers suggesting text-transform: capitalize
are incorrect as that option capitalizes each word.
如果您只希望每个元素的第一个字母为大写字母,但这绝对不能接近实际的句子大写:
Here's a crude way to accomplish it if you only want the first letter of each element to be uppercase, but it's definitely nowhere near actual sentence caps:
p {
text-transform: lowercase;
}
p:first-letter {
text-transform: uppercase;
}
<p>THIS IS AN EXAMPLE SENTENCE.</p>
<p>THIS IS ANOTHER EXAMPLE SENTENCE.
AND THIS IS ANOTHER, BUT IT WILL BE ENTIRELY LOWERCASE.</p>
这篇关于在Sentence中使用CSS将大写字母转换为小写字母和第一个大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!