<p>You can use the :first-line pseudo-element to add a special effect to the first line of a text. The rest of the line will revert to the basic CSS and styling. Here it works for P tag.</p> <div>You can use the :first-line pseudo-element to add a special effect to the first line of a text. The rest of the line will revert to the basic CSS and styling. Here it works for DIV tag but we have also used a <i>first-letter</i> pseudo element to change the <b>Y</b> in this line.</div><br> <span>You can use the :first-line pseudo-element to add a special effect to the first line of a text. <b>But it does not work for SPAN tag</b>.</span><br><br> <section>You can use the :first-line pseudo-element to add a special effect to the first line of text in a SECTION tag.</section> <header>You can also use the :first-line pseudo-element to add a special effect to the first line of text in ARTICLE, ASIDE, FOOTER,HEADER, NAV and other HTML5 Structural tags.</header>
div:first-line { color:#00f; font-variant:small-caps; } p:first-line { color:#f0f; font-size: 30px; } div:first-letter { font-size:200%; color:#2AeBE2; background-color:yellow; } span:first-line { color:#f0f; text-decoration:line-through; } span:after { content:"Glad :after selector works in SPAN tag"; color:white; background-color:red; } section:first-line { color: white; background-color:#0f6; text-decoration:overline; } header:first-line { color:#f00; font:italic bold 12px/30px Georgia, serif; } footer:first-line, article:first-line, aside:first-line, nav:first-line { color:#ff0; //font-size:25px; font:italic bold 25px/30px Georgia, serif; }