Why pseudo ::before and ::after elements? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why pseudo ::before and ::after elements?

I searched the web but I couldn't understand what is pseudo before and after elements. I saw many people use these elements but still I couldn't understand from them. Could anyone help me By explaining the thing in a different way?

9th Jun 2018, 8:45 AM
Rejwan Islam
Rejwan Islam - avatar
3 Answers
+ 5
Basically, ::before and ::after are used to add text or image before and after the content of an element respectively. Check out this sample code and see if you can understand it better visually. https://code.sololearn.com/W6Vvlig47RvP/?ref=app
9th Jun 2018, 9:46 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 3
for example: it use for adding content or space to an span or label, or adding image icon before a list of element, and any other by content: 'PlaceOfYourData';
9th Jun 2018, 9:23 AM
Mohammad Mehdi Takalloo
Mohammad Mehdi Takalloo - avatar
+ 1
Thanks Jonathan Pizarra.... and also mohammad mehdi.
9th Jun 2018, 10:02 AM
Rejwan Islam
Rejwan Islam - avatar