Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to capitalize first line with CSS? ::first-line pseudo-element not working

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;
}

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.

like image 370
user1390754 Avatar asked Aug 04 '12 13:08

user1390754


1 Answers

text-transform on :first-line is really buggy right now, see the reference here http://reference.sitepoint.com/css/text-transform

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

Regards,

like image 145
Saurabh Kumar Avatar answered Sep 19 '22 17:09

Saurabh Kumar