Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Lou Chua8,338 Points
When using pseudo-elements, to which element are rules being applied?
As the title says, when using ::before or ::after like in the video are the additional rules like margin and padding going to be applied to the content being inserted or will it be applied to the element specified by the selector?
(ex. when the .pdf image in inserted before the dload class are the margins being applied to the class or the inserted image?)
Scott Moore4,050 Points
Lou, they are going to be applied to class. Lets say you put the image in ::whichever. Then apply padding. It will move the image away from whater it is it is next to. Try it in a codepen to see. Hope it helps.