html - Firefox 可以显示 JP2 图像吗?

标签 html css image file web

我最近将我网站上的每张图片都转换为 JP2 以减小文件大小,同时保持透明度。

在 Safari 上一切正常,但 Firefox 不显示 JP2 图像,但它显示 PNG。

Firefox 是否不支持 JP2?

最佳答案

JP2 images are not supported on Firefox .

但您可以使用 <picture> 元素提供多种图像格式,以便浏览器可以选择和显示支持的图像格式:

<picture>
    <source srcset="img/example.jp2" type="image/jp2"> <!-- format supported by safari -->
    <source srcset="img/example.webp" type="image/webp"> <!-- format supported on many browsers -->
    <source srcset="img/example.jpg" type="image/jpeg"> <!-- common supported format -->
    <img src="img/example.jpg" alt="example-alt-text"> <!-- default -->
</picture>

注意:JP2 格式的替代方案可以是 WebP 格式:

关于html - Firefox 可以显示 JP2 图像吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54980431/

相关文章:

带有html5的图像按钮

objective-c - 计算 Objective C (Cocoa) 中文件夹内的文件数

html - 确保相对定位的元素留在顶部容器内

html - &lt;!DOCTYPE html> - 文档类型声明只能出现一次

html - 使两个共享插件(facebook 和 twitter)在同一行对齐(垂直对齐)

jquery - 显示没有模态框的 Bootstrap 3 灰色背景

javascript - UI 中的 PrettyPrinting JSON

javascript - 如何在 html 电子邮件内容中显示通过 JS 获取的月份?

html - 根据谷歌脚本中的图像大小调整行大小

java - Wicket:从绝对路径加载图像