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

  • 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

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/

| improve this answer | |

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