Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

p.class:first-line does not work

Tags:

css

I'm trying to use the :first-line pseudo selector but it seems not to be working, and I cannot figure out why. I've tried using ::first-line as well but to no avail. (Note, this has nothing to do with border radius).

p.intro:first-line {
  text-transform: uppercase;
}
<p class="intro">Instead of attempting to cover the full range of <abbr title="Cascading Style Sheets">CSS</abbr> selectors, I think it makes sense to begin with a subset of the most widely supported. The <a href="http://www.quirksmode.org/css/contents.html">compatibility charts compiled by Peter-Paul Koch</a> provide
  detailed support information.</p>
like image 836
Steven Avatar asked Jun 08 '15 17:06

Steven


1 Answers

I only see this issue in Chrome. Apparently there's a bug that has not been fixed yet: https://code.google.com/p/chromium/issues/detail?id=129669

There is a workaround proposed in this SO post which says you can use https://github.com/octopi/Linify to get the effect using a jquery plugin. Essentially, use linify to select the first line and then apply the property of text-transform: uppercase to the first line.

like image 77
Josh Durham Avatar answered Oct 19 '22 23:10

Josh Durham