CSS { In Real Life } | Quick Tip: Style Pseudo-elements with Javascript Using Custom Properties
Oh, this is smart! You can’t target pseudo-elements in JavaScript, but you can use custom properties as a proxy instead.
Oh, this is smart! You can’t target pseudo-elements in JavaScript, but you can use custom properties as a proxy instead.
A thorough deep dive into generated content in CSS.
This is really, really clever. You can’t use generated content (:before
and :after
) on replaced content. The img
element is replaced content …but only when the image actually loads. So if the image fails to load, you can apply specific fallback styles (using :before
and :after
).