Languages
[Edit]
EN

CSS - insert text to element using styles only

0 points
Created by:
Welsh
902

In this article, we would like to show you how to insert text to element using styles only

Quick solution:

Note:

The ::before and ::after elements are inline by default.

 

Practical example

Edit

In order to insert text to the element using styles only, we use ::before and ::after pseudo elements. They allow us to add content property to the selected element (::before - as the first child, ::after - as the last child of the selected element).

 

References

Edit
  1. ::before - CSS: Cascading Style Sheets | MDN
  2. ::after - CSS: Cascading Style Sheets | MDN
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