< IMG> vs< image>标记为HTML [英] <img> vs <image> tag in HTML

查看:180
本文介绍了< IMG> vs< image>标记为HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一篇介绍性的HTML课程。我记得9年前我发现学习HTML的时候,< img> < image> 至少在IE中用于显示图像的标签。事实上,< image> 仍然适用于5款顶级浏览器的最新版本。

code>< image> 不正确,并且不会使用 http://验证器进行验证。 w3.org 。但是,如果使用< image> 而不是< img>

此外,我假设现代浏览器仅显示使用< image> 标签创建的图片因为这是初学者常犯的错误。这个假设是否正确?

解决方案

是,否。正如你指出< image> 长期以来一直是< img> 的同义词。我认为这是一个早期的Netscape浏览器,首先这样做,可能是为了弥补用户错误,或者可能是因为当时有争议,实际上该元素是否应该被称为< image>

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.

这篇关于&LT; IMG&GT; vs&lt; image&gt;标记为HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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