为什么谷歌浏览器不显示 base64 编码的图像? [英] Why does Google Chrome not show base64 encoded images?

查看:185
本文介绍了为什么谷歌浏览器不显示 base64 编码的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Firefox、Internet Explorer、Opera 接受以下代码:

Firefox, Internet Explorer, Opera accept following code:

<html>
<head>
<style type="text/css">
.minus
{
    width: 11px;
    height: 11px;
    background-image: url("data:image/gif;base64,R0lGODlhCwALAIABAAAAAP///yH5BAEAAAEALAAAAAALAAsAAAIUhI8Wy6zdHlxyqnTBdHqHCoERlhQAOw");
}
</style>
</head>
<body>
<div class="minus">
</body>
</html>

Chrome(版本 19.0.1084.56)没有.为什么?

Chrome (Version 19.0.1084.56) does not. Why?

推荐答案

这是 Chrome 中的一个错误,请参阅 错误 #105725.必须填充 base64 字符串.以下解决方案工作正常: http://jsfiddle.net/TunfH/ (我已添加 == 最后).

This is a bug in Chrome, see bug #105725. The base64-string has to be padded. The following solution works fine: http://jsfiddle.net/TunfH/ (I have added == at the end).

<html>
<head>
<style type="text/css">
.minus
{
    width: 11px;
    height: 11px;
    background-image: url("data:image/gif;base64,R0lGODlhCwALAIABAAAAAP///yH5BAEAAAEALAAAAAALAAsAAAIUhI8Wy6zdHlxyqnTBdHqHCoERlhQAOw==");
}
</style>
</head>
<body>
<div class="minus"></div>
</body>
</html>

这篇关于为什么谷歌浏览器不显示 base64 编码的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆