How to place SVG in pseudo element (::before, ::after)?

Hi there,
I would like to style a container with a ::before pseudo element. How do I place an SVG as content with the pseudo option? When I encode the SVG for example with URL-encoder for SVG, it renders the content as text. Or do I have to do it with CSS?

Thx in advance!

Hi Lars,
Welcome to the forum and thanks for reaching out!

I think the only way is to use the SVG as a background image with ::before.

Best regards,
timmse


1 Like