我正在尝试决定是否对我的一个网站上的某些图像(图形)和拇指使用 Base64 编码,但我无法完全找到在尝试决定时出现的一些效率问题的答案。
这是我的理论,但我在这方面没有足够的知识来完全确定我需要帮助的是什么:
The use of embedded base64 images reduce the number of HTTP requests, increasing the size of the file by relatively a 30%, which is ok for small images/graphics, but these images are not cached, however if you embed these base64 images into your CSS file they will be cached but as one file (the CSS).
我需要知道我是否错了,错了多少,或者我是否遗漏了任何重要信息。
[编辑]
我发现一些非常有用的信息改变了我在谷歌中的关键字 Data URI scheme .
最佳答案
如果您有很多总是一起加载的小图像,您应该看看 sprite。使用 sprite,您可以获得一个请求的开销,但会减少 base64 编码的开销(流量增加 33%)。因此,如果您的 sprite 比响应 header 大 3 倍,则可以节省带宽。
如果您有许多随机的小图像,请使用 base64 编码。
关于css - Base64编码缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18388325/