< IMG> vs< image>标记为HTML [英] <img> vs <image> tag in HTML
问题描述
我正在写一篇介绍性的HTML课程。我记得9年前我发现学习HTML的时候,< img>
和< image>
至少在IE中用于显示图像的标签。事实上,< image>
仍然适用于5款顶级浏览器的最新版本。
< image>
而不是< img> $ c,则任何人都知道浏览器不会显示图像
此外,我假设现代浏览器仅显示使用< image>
标签创建的图片因为这是初学者常犯的错误。这个假设是否正确?
解决方案是,否。正如你指出< image> 长期以来一直是< img>
的同义词。我认为这是一个早期的Netscape浏览器,首先这样做,可能是为了弥补用户错误,或者可能是因为当时有争议,实际上该元素是否应该被称为< image> $ c无论如何,正如pst指出的那样,一旦它被实现在一个或多个浏览器占据了当时市场的主导地位,网页依赖于它。然后,它的持久性会降低到浏览器制造商面临的商业压力。如果所有主流浏览器都支持它,那么浏览器A决定尽管版本V支持它,但版本V + 1不支持版本V + 1,只要版本V + 1发布,他们就会收到大量消息,您的浏览器是垃圾,我将切换到浏览器B。
HTML5解析规范要求< image>标记被映射到树构建阶段中的 img
元素,因此永远没有任何理由使用它。
与其他HTML消费者相比,我不太关心浏览器,比如不太熟悉的搜索引擎。我认为 img
同义词的图片
并不广为人知,因此许多此类工具无法提取< image>
作为引用图像资源的参考。
I am writing an introductory HTML course. I remember discovering 9 years ago as I was learning HTML that both <img>
and <image>
worked as the tag for displaying images, at least in IE. Indeed, <image>
still works in the latest versions of the 5 top browsers.
I realize that <image>
is incorrect and will not validate with http://validator.w3.org. However, is anyone aware of a browser that will not display an image if <image>
is used instead of <img>
?
Furthermore, I assume the modern browsers display images created with the <image>
tag simply because it is a common mistake that beginners make. Is this assumption correct?
解决方案 Yes and no. As you point out <image>
has been a synonym for <img>
for a long time. I believe it was an early Netscape browser that first did this, possibly to compensate for user error, or possibly because there was dispute at the time whether the element should actually be called <image>
or <img>
.
Anyway, as pst points out, once it was implemented in a browser that dominated the market of the time, web pages came to rely on it. Its persistence is then down to commercial pressure on the browser manufacturers. If all the major browsers support it, then Browser A decides that although it supported it in Version V, it won't support it in version V+1, as soon as version V+1 is released, they get lots of messages saying "Site S is broken in your latest browser. You browser is rubbish. I'm going to switch to browser B".
The HTML5 parsing spec requires that the <image>
tag is mapped to the img
element at the tree construction stage, so there can never be any justification for using it.
I would be less concerned about browsers, than other HTML consumers, such as the lesser known search engines. I believe that the image
for img
synonym is not widely known, and the many such tools would therefore fail to pick up <image>
as referencing an image resource.
这篇关于< IMG> vs< image>标记为HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!