Horje
How to use the ::first-line pseudo-element in CSS ?

The ::first-line pseudo-element in CSS is used to style the first line of a block-level element. It allows you to apply styles specifically to the first line of text within an element, making it useful for typographic enhancements or creating decorative effects.

Syntax:

selector::first-line {
/* Styles for the first line */
}

Features:

  • Block-Level Elements Only: The ::first-line pseudo-element only works with block-level elements. It won’t have any effect on inline elements.
  • Selection Limitations: The ::first-line pseudo-element allows styling only for the first line of text within a block. You cannot select specific words or characters within that line.
  • Style Limitations: Some styles may not be applied to ::first-line. For example, properties like display, float, and position do not apply to ::first-line.



Reffered: https://www.geeksforgeeks.org


CSS

Related
What is CSS Variable ? What is CSS Variable ?
How to calculate the Specificity value in CSS ? How to calculate the Specificity value in CSS ?
Explain the ease-in and ease-out in CSS Explain the ease-in and ease-out in CSS
How to create a Smooth Transition on hover using CSS ? How to create a Smooth Transition on hover using CSS ?
Explain the use of Media Queries in CSS ? Explain the use of Media Queries in CSS ?

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
13