如何用CSS大写第一行? ::第一行伪元素不工作 [英] How to capitalize first line with CSS? ::first-line pseudo-element not working

查看:184
本文介绍了如何用CSS大写第一行? ::第一行伪元素不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我有一个段落,我想要大写整个第一行。我将第一段设置为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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆