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

how do I target a given pseudo-element

So I am using TwiGet (a twitter plugin for Wordpress) and it take a given tweet shows "@" then user name its rendering this by <p> @ <a>user</a> tweet contents</p> I can target any <a> with in the <p> and make it bold for example but what if I only want to target an <a> that immediately follows the text "@", is there a way to target an element based on its preceding text?

1 Answer

Sean T. Unwin
Sean T. Unwin
28,690 Points

To target an element based on preceeding text you'd have to use JavaScript, unless there are specific attributes that are attached to the element you want to target then you can specify with CSS.

Generally speaking, you cannot target a pseudo-element although there is this StackOverflow discussion. Maybe that will help?