为什么< img>标签没有href属性? [英] Why <img> tag dont have href attribute?

查看:76
本文介绍了为什么< img>标签没有href属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在许多网页上看到图像作为链接是很常见的。

作者通过在< atag中放置一个< imgtag来创建它们。

这是额外使用另一个标签。


但是为什么浏览器不支持< imgtag的href属性?


是否随时这出现在W3C?

It is very common to see an image as a link on many web pages.
Authors create them by putting an <imgtag inside a <atag.
This is very much extra use of another tag.

But why browsers dont support href attribute for <imgtag?

Whether at any time this came up at W3C?

推荐答案

biju写道:
biju wrote:

这是很常见的在许多网页上看到图像作为链接。

作者通过在< atag中放置一个< imgtag来创建它们。

这是非常多的使用另一个标签。
It is very common to see an image as a link on many web pages.
Authors create them by putting an <imgtag inside a <atag.
This is very much extra use of another tag.



不,不是。你*可以*在A里面自己拥有一个IMG,但你可以

也有


< a href =" something"> text< ; img src =" blah" alt =" blah"> more text< img

src =" foo" alt =" bar">甚至更多文字< / a>


没有任何理由可以采用其他方式来做同样的事情。

图像是图像,链接是链接。

No it isn''t. You *can* have an IMG by itself inside an A, but you can
also have

<a href="something">text<img src="blah" alt="blah">more text<img
src="foo" alt="bar">and even more text</a>

There isn''t any reason to have another way to do the same thing. An
image is an image, a link is a link.


4月6日,9:54 * pm,Harlan Messinger
< hmessinger.removet ... @ comcast.netwrote:
On Apr 6, 9:54*pm, Harlan Messinger
<hmessinger.removet...@comcast.netwrote:

< a href =" something"> text< img src = "等等" alt =" blah"> more text< img

src =" foo" alt =" bar">甚至更多文字< / a>
<a href="something">text<img src="blah" alt="blah">more text<img
src="foo" alt="bar">and even more text</a>



是的,在这种情况下,我们需要< atag。


但是我在谈论网页的情况我们只看到

只是一个< imgtag而且没有文字内容或任何其他内容

< atag。

喜欢: -

< a href =" some_page.html">< img src =" blah_image.jpg" alt =" blah">< / a>

Yes in that case we need <atag.

But I was talking about the case in lot to web pages where we only see
just a single <imgtag and no text content or any thing else insde a
<atag.
Like:-
<a href="some_page.html"><img src="blah_image.jpg" alt="blah"></a>


biju写道:
biju wrote:

4月6日,9:54 pm,Harlan Messinger

< hmessinger.removet ... @ comcast.netwrote:
On Apr 6, 9:54 pm, Harlan Messinger
<hmessinger.removet...@comcast.netwrote:

>< a href =" something"> text< img src =" blah" alt =" blah"> more text< img
src =" foo" alt =" bar">甚至更多文字< / a>
><a href="something">text<img src="blah" alt="blah">more text<img
src="foo" alt="bar">and even more text</a>



是的,在这种情况下,我们需要< atag。


但我正在谈论网页中的案例我们只看到

只是一个< imgtag而且没有文字内容或任何其他内容

< atag。

喜欢: -

< a href =" some_page.html">< img src =" blah_image.jpg" ALT ="等等">< / A>


Yes in that case we need <atag.

But I was talking about the case in lot to web pages where we only see
just a single <imgtag and no text content or any thing else insde a
<atag.
Like:-
<a href="some_page.html"><img src="blah_image.jpg" alt="blah"></a>



正如我问你:为什么还有另一种方法来做同样的事情?
的事情?保存标签并不完全是圣杯。

As I asked you: why does there have to be another way to do the same
thing? Saving a tag is not exactly the Holy Grail.


这篇关于为什么&lt; img&gt;标签没有href属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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