+ 1

What is the use of ::before ::after?

When to use them kindly explain with examples for better explanation.

21st Jan 2023, 3:38 PM
Mohammad Arsalan Rather
Mohammad Arsalan Rather - avatar
2 Answers
+ 1
They're pseudo-selectors. With them, you can specify which elements to target in a DOM tree. For example: .fancy-div p::before allows you to target all elements in a fancy-div class that come before p elements. This could be used to apply a bottom margin, fancy bottom border, a background image inside the element, etc.
21st Jan 2023, 4:12 PM
Sam
0
đŸ€”đŸ€”đŸ€”đŸ€”
21st Jan 2023, 5:59 PM
arturop200
arturop200 - avatar