TOP CATEGORIES

×

How to work first-line pseudo-element in CSS?

R

R. Wilson

A CSS pseudo-element is used to add style to a specific part of the selector element in CSS by using:

  • :: before
  • :: after
  • ::first-line, etc...

::first-line

The first-line pseudo-element is used to apply a special style to the first line of an element's text.

For Example "::first-line Pseudo-element"

p::first-line {

     background-color: #ded9d9;

     color: #00758F;

     font-weight:800;

  }

This CSS code works for only one line of the content that does no matter how many words are in a line after breaking the line of the paragraph, this "::first-line Pseudo-element" will not work, it just works only in a single line of code of the paragraph.

0 votes

Your Answer

Email: advertise@gdatamart.com

Donate: To Support US

© 2024 GDATAMART.COM (All Rights Reserved)