...

/

Text Styling Pseudo-Elements

Text Styling Pseudo-Elements

Learn to style text with pseudo-elements like ::first-letter, ::first-line, ::selection, and ::placeholder.

Text styling pseudo-elements allow us to apply styles to specific parts of the text within an element, such as the first letter or the first line.

::first-letter

The ::first-letter pseudo-element styles the first letter of the first line of a block-level element.

Styling the first letter

In the above CSS code, we style the first letter of the paragraph to create a drop-cap effect.

::first-line

The ::first-line pseudo-element styles the first line of a block-level element.

Styling the first line

The above CSS style applies bold weight and a different ...