Why You Should Stop Base64 Encoding SVGs in CSS (And What to Use Instead)
If you've built any modern frontend project, chances are you've dropped an SVG directly into your stylesheet as a Base64 string: /* The classic 2 AM solution */ .icon { background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTEyIDJMMiA3bDEwIDUgMTAtNS0xMC01eiIvPjwvc3ZnPg=='); } It works, it eliminates an extra HTTP request, and the icon renders. But down the line, this habit almost always comes back to bite you. Here is why Base64 encoding in CSS is an anti-pattern, and what modern frontend developers should b
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in