[英]Chrome loads the webpage perfectly, every other browser fails. Why?
I wrote an HTML page where I needed to embed certain sections of an image with hyperlinks. 我写了一个HTML页面,需要在其中嵌入带有超链接的图像的某些部分。 For this I used SVG tags so that I don't have to use image map tags, since they cannot scale well with the screen. 为此,我使用了SVG标签,因此不必使用图像地图标签,因为它们无法在屏幕上很好地缩放。
This is what the page looks like in chrome 这是Chrome网页的外观
<svg id="mySVG" style="width:100%;height:100%;" version="1.1" viewbox="0 0 2000 2000" xmlns="http://www.w3.org/2000/svg">
<image style="width:inherit;height:inherit;" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="Image URL">
</image>
<a xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="Image URL">
<circle cx="45%" cy="33%" r="120" stroke="black" stroke-width="3" opacity="0" fill="#fff">
</circle>
</a>
.
.
//More <a> tags representing the various clickable points in the image
.
.
.
</svg>
Basically the image in the IMAGE tags don't load and the screen takes the color of the background. 基本上,不会加载IMAGE标签中的图像,并且屏幕采用背景色。 I know that chrome is much more lenient with the rules but I don't think I have made any errors. 我知道chrome对规则的宽容得多,但我认为我没有犯任何错误。 This code works perfectly well with Chrome, but in any other browser, the images don't load. 这段代码可与Chrome完美配合,但在任何其他浏览器中,图像均不会加载。 The image links like 'Wallpaper', 'Button', 'poster' although open separately in new tabs if I click the point in the paper where they are supposed to be but otherwise they don't work. 图像链接,如“墙纸”,“按钮”,“海报”,尽管如果我在纸张中单击它们应该位于的位置,但会在新选项卡中单独打开,否则它们将不起作用。
An SVG <image>
tag must have width and height attributes in SVG 1.1, CSS properties are not allowed. SVG <image>
标签在SVG 1.1中必须具有width和height属性,不允许CSS属性。
Chrome is experimenting with implementing SVG 2 CSS Properties for width and height which is why it works there. Chrome浏览器正在尝试实现SVG 2 CSS属性的宽度和高度,这就是它在那里工作的原因。 The SVG 2 specification is unfinished and no other UA currently implements this feature. SVG 2规范尚未完成,并且当前没有其他UA实现此功能。 I imagine as the specification nears completion more UAs will implement this functionality though. 我想随着规范即将完成,更多的UA将实现此功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.