Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Selectors Advanced Selectors Pseudo-Elements - ::before and ::after

Alex Wylie
Alex Wylie
4,364 Points

Pseudo-Elements - ::before and ::after Why do the icons stay as links?

Just curious, when i did the exercise for this video i noticed that the icons stay as links.

I was expecting that these elements would be placed before the "a" tag, and therefore they wouldn't be within the link?

2 Answers

Steven Parker
Steven Parker
231,261 Points

The pseudo elements are inside the element they are applied to.

The created pseudo elements become the first ("before") or last ("after") child of the element they are applied to, so in the case of an anchor element, they would also be part of the link.

Alex Wylie
Alex Wylie
4,364 Points

thank you! This makes sense now