pseudo element capabilities

Hey, is there anything that a pseudo element can't do that a normal element can? I know this is quite broad, but is there perhaps certain properties that wouldn't work on them etc? Thanks in advance.
16 Replies
MarkBoots
MarkBoots4w ago
well, the contents of a pseudo element can not be read by a screenreader all other properties will probably work (but that's a broad answer as well)
snxxwyy
snxxwyyOP4w ago
yeah that's true. is that about all the limitations you reckon?
MarkBoots
MarkBoots4w ago
can not think of something else, but for a better answer, i need more
clevermissfox
clevermissfox4w ago
You can’t give the content any HTML, it can take a string for example but can’t do something like this:
content;”This is a+ <span style=‘font-weight: 700;’>pseudo>/span> + “ element”;
content;”This is a+ <span style=‘font-weight: 700;’>pseudo>/span> + “ element”;
But you can use an attr for the content property which is a fun one !
snxxwyy
snxxwyyOP4w ago
yeah that's fair enough. i was more just wondering about limitations oh yeah true, and then you can't style the attribute content seperately like in your example either. so i guess a limitation is being unable to style content content
Chris Bolson
Chris Bolson4w ago
You can’t :hover ( or similar) on pseudo elements (not a property but worth taking into account)
snxxwyy
snxxwyyOP4w ago
oh yeah, i'm pretty sure you can style them on hover of the parent though which is useful
ἔρως
ἔρως4w ago
you cant attach events
snxxwyy
snxxwyyOP4w ago
Oh with js?
ἔρως
ἔρως4w ago
yup you also can't use it as an element in javascript you can access the styles set, but that's it
snxxwyy
snxxwyyOP4w ago
Ah okay, I didn’t know that
ἔρως
ἔρως4w ago
pseudo-elements are weird
Jochem
Jochem4w ago
They're not quite in the DOM
snxxwyy
snxxwyyOP4w ago
In what way? The fact they’re not in the accessibility tree?
Jochem
Jochem4w ago
in that they're not accessible by JS because they're not really quite part of the DOM
snxxwyy
snxxwyyOP4w ago
Ohh okay
Want results from more Discord servers?
Add your server