DEV Community

Cover image for Amazing :: before & ::after Simple CSS Explained
Nikhil Bobade
Nikhil Bobade

Posted on

Amazing :: before & ::after Simple CSS Explained

Hey Guys ,

Today We are discussed very important topic in CSS. A pseudo-element is used to style specified parts of an element in this post I get some reference from Insharamin please follow her on twitter his have a good web development content.

A many people are is donโ€™t understand how to use ::before & ::after. A CSS ::before and ::after is a very useful pseudo element that is very simple and easy to understand example in this article so that anyone can understand it better Happy Reading.

What actually are ::before and ::after ?

  • In CSS, these are known as pseudo elements.
  • A pseudo-element is used to style specified parts of an element.

For example, it can be used to:

  • Style the first letter, or line, of an element
  • Insert content before, or after, the content of an element.

:: before :-

The ::before pseudo-element can be used to insert some content before the content of an element. You can be add anything before the content.

::after :-

The ::after pseudo-element can be used to insert some content after the content of an element. below is the best example for ::before and ::after.

I hope you like this also comments about your thoughts. For more content follow me on Instagram @developer_nikhil27.

Thank you.

Top comments (0)