Languages
[Edit]
EN

CSS - style first line of the text only

3 points
Created by:
Zayyan-Todd
860

In this article, we would like to show you how to style only the first line of the text using CSS.

Quick solution:

Note:

The ::first-line CSS pseudo-element applies styles to the first line of the specified element.

Screenshot:

Styling only the first line in the text using CSS.
Styling only the first line in the text using CSS.

 

Practical example

Edit

In this example, we use ::first-line pseudo-element to specify the style for the first line of the div element only.

References

Edit

Alternative titles

  1. CSS - style only first line in text
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join