Home Link

Hello, my name is Brett Terpstra, and it’s nice to meet you. Elegant solutions to complex problems. Curious?

Posts Tagged ‘base64’

Jun 19
2010

Just a quick hit on this one… when hacking away at the styles of things one probably shouldn’t be hacking away at, embedding images right in the CSS is a handy trick. It’s done by Base64 encoding the image, removing line breaks from the resulting string, and using it to set the background property for the CSS rule.

It looks something like this (truncated):

[…]

The image/png changes depending on the filetype that’s encoded, becoming image/jpg or image/gif, etc…

Entries (RSS) and Comments (RSS), or Subscribe by Email