如何用CSS大写第一行? ::第一行伪元素不工作 [英] How to capitalize first line with CSS? ::first-line pseudo-element not working
问题描述
现在我有一个段落,我想要大写整个第一行。我将第一段设置为IDfirstp并尝试:
Right now I've got a paragraph and I'd like to capitalize the entire first line. I've set the first paragraph to an ID "firstp" and tried:
#firstp::first-line {
text-transform: uppercase;
}
我试过了 text-大写
,但是也不起作用。奇怪,因为我已经设法改变第一个字母(改变字体大小)使用 #firstp:first-letter
。
I've tried it with text-transform: capitalize
but that doesn't work either. It's strange because I've managed to change the first letter (changed font size) using #firstp:first-letter
.
推荐答案
text-transform
-line 现在确实有问题,请参阅此处的参考资料 http:// reference.sitepoint.com/css/text-transform
您可以使用此jquery插件 linify https://github.com/octopi/Linify 选择第一行,然后应用的属性, text-transform:uppercase
You can use this jquery plugin called linify https://github.com/octopi/Linify to select the first line and then apply the property of text-transform: uppercase
回答:
这篇关于如何用CSS大写第一行? ::第一行伪元素不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!