1

Newbie to CSS. I don't get why :before and :after are used. Can I get some easy explanation,please?

closed as off-topic by Stephen Ostermiller Mar 6 '18 at 3:25

  • This question does not appear to be about webmastering within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I'm closing this question as off-topic because it is a programming related question. Programming questions are usually better asked at stackoverflow.com – Stephen Ostermiller Mar 6 '18 at 3:25
  • 1
    You flagged my comment saying "read the help center page on CSS coding please". The help center says: "There are some types of questions about running websites that don't belong on this site: HTML, JavaScript, or CSS coding -- Detailed questions about how to code something are usually a better fit for Stack Overflow where there are more programmers that answer questions." – Stephen Ostermiller Mar 6 '18 at 11:29
3

When we use before it means, this css will apply (virtually) before the default content in html element, and vice-versa for after but the catch is these are called pseudo selectors, which does not change the real DOM, i.e. the change would be visible but not real.

Refer this to learn more about it : https://css-tricks.com/almanac/selectors/a/after-and-before/

Not the answer you're looking for? Browse other questions tagged or ask your own question.