我对 Firefox 中 IMG 标签中使用的 SVG 有点困惑。
首先是 Codepens:
- http://codepen.io/doughamlin/pen/Fgosn
- http://codepen.io/doughamlin/pen/zmBda
Codepen 1 使用 SVG 并且不能在 Firefox(版本 26)中运行。 Codepen 2 使用 JPG 并在 Firefox 中正常工作。两者之间没有其他区别。它们都可以在 Chrome、Safari 和 IE 10 中正常工作。
Firefox 中的检查器显示 SVG 的高度和宽度为 0。如果我从包含 IMG 标签的 H1 中删除 float:left ,则 SVG 显示正常,但我没有找到其他方法来使 SVG 显示我无法弄清楚为什么图像首先具有 0 维.
这只是一些模糊的 Firefox 错误,还是我确实做错了什么?
这篇文章将帮助您了解为什么它不起作用
https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_Image_Tag
There are some important things to take note of (referenced from the W3 specs):
If you do not set the x
or y
attributes, they will be set to 0
.
If you do not set the height
or width
attributes, they will be set to 0
.
Having a height
or width
attribute of 0
will disable rendering of the image.