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 trialDaniel Kip
5,922 Pointspseudo elements vs real elements?
I would like to simply know: when does a pseudo element becomes for useful than, let's say, placing an image next to a download button and giving it the usual set of css rules?
Thanks a lot for the patience.
2 Answers
Steven Parker
231,269 PointsThere's usually more than one way to do any particular thing using HTML and CSS combined. So if what you want to do can be done with or without using a pseudo-element, and the level of difficulty is similar, perhaps a pseudo-element is not a good choice for that situation.
But there are other situations, some of which are described on the page Jacob suggested, where using a pseudo-element can get the job done much more easily. These are the times where the pseudo-element is a good choice.
Remember, your skills are like a toolbox, you pick the tool that does the best job in each situation.
Jacob Mishkin
23,118 PointsThere is so much you can do with pseudo elements, if you want take a look
Daniel Kip
5,922 PointsJacob, the link is very useful, thank you for reading and answering.
Daniel Kip
5,922 PointsDaniel Kip
5,922 PointsSteven, the toolbox comparison really sums up the mindset I should keep in mind. I come across many possibilities with html and css and sometimes i get confused. Thank you for the patience and the effort answering my question.