By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,260 Members | 1,677 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,260 IT Pros & Developers. It's quick & easy.

Why <img> tag dont have href attribute?

P: n/a
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?
Apr 7 '08 #1
Share this Question
Share on Google+
17 Replies


P: n/a
biju wrote:
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.
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.
Apr 7 '08 #2

P: n/a
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">and even more text</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>
Apr 7 '08 #3

P: n/a
biju wrote:
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">and even more text</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.
Apr 7 '08 #4

P: n/a
On 7 Apr, 02:36, biju <bijumaill...@yahoo.comwrote:
It is very common to see an image as a link on many web pages.
It's part of HTML (and the W3C's mental model of how things ought to
work) that specifications should be "simple" (in formal terms as a
protocol) rather than "simple" for users to hand code.

There have been intentions at various times to roll up all of the
"link" elements, <a>, <img>, <linkinto one (maybe <object>) and to
treat _everything_ as "some sort of link to an extenal resource". An
<imgwould become "The resource link that imports the resource
immediately and renders it", <awould become "A link to a resource
that's only traversed if the user activates it" and <linkwould be "A
resource link that's retrieved but not rendered directly".

Thinking in these terms, we see a logical interpretation of why <a>
and <linkuse href (be aware of this linked resource, but don't show
it) and <imguses src (render this resource right now). Within this
view, it would indeed be possible to do what you describe, and to make
the behaviour (now or later) explicitly coupled to the attribute(s)
used. <img src="..." href="..." could easily be defined to normally
show the image from src, then traverse the link from href if
activated. As the behaviour is then only dependent on the attributes,
we could roll all of these behaviours into <object(or "<foo>") and
ditch <imgand <aaltogether. If you look around XHTML 2.*, then
you'll see thoughts in this direction.

However HTML is also bound by its legacy behaviour. This stuff just
ain't going to happen. Nor (IMHO) should it. Having both <aand
<img>, and their use of different attribute names, just isn't a big
enough problem to beginners to worry about changing it.
Apr 7 '08 #5

P: n/a
In article <aF*********************@reader1.news.saunalahti.f i>,
"Jukka K. Korpela" <jk******@cs.tut.fiwrote:
(In fact, some browsers that have special kind of support to images have
implemented <imgelements in a very link-like manner: the alt text or
other identifying text is presented to the user, who may then follow it
as a link, opening the image, possibly in an external viewer.)
The way the person who gave me my winbox set it up, in IE6 (but not in
FF) all links to images (as in enlargements from thumbnails) trigger
Photoshop to open. This is no doubt different to what is being said
here. But I thought I would chime in as it has always been an oddity
(not that I use the winbox much).

--
dorayme
Apr 7 '08 #6

P: n/a
in comp.infosystems.www.authoring.html, Harlan Messinger wrote:
In other words, if Barnes & Noble (bn.com) had simple text links for
Books, DVDs, Music, etc., and I went to their site to buy the Counting
Crows album that had just been released, and I discovered that the Music
links was purple, I would say, "Oh, I guess I've been to their music
page before" and forget about buying the Counting Crows album--never
mind that the link is purple because three days earlier I was browsing
for samba music.
No, you remember that you were there 3 days ago, so you can only scan
purple links when looking music section, and you are there faster than
without. After music link, you may see links like:

rock
rumba
samba

And wonder if you already looked the rock section. Or come back next day,
and wonder which one was it, which you followed yesterday.

If you don't know how to categorize music (like me), or music you wish to
buy don't categorize well (also me), knowing where you have been helps
you find 'new' content, or 'old' content. But it is just a hint, you can
easily ignore it, when looking specific content.
There are links, and then there are links. There are sites and there are
sites. Not all sites need to be arranged so that, like a resident of
Konigsburg traversing its bridges, one can make an Eulerian game out of
visiting every page on the site without visiting any of them twice.
You see visiting color only hint for not visiting some page again. It is
also hint to visit it again. Of course it may not always help, but it
hardly confuses either, as far as difference is not too drastic.
--
Lauri Raittila <http://www.iki.fi/lr>
Apr 8 '08 #7

P: n/a
Lauri Raittila wrote:
in comp.infosystems.www.authoring.html, Harlan Messinger wrote:
>In other words, if Barnes & Noble (bn.com) had simple text links for
Books, DVDs, Music, etc., and I went to their site to buy the Counting
Crows album that had just been released, and I discovered that the Music
links was purple, I would say, "Oh, I guess I've been to their music
page before" and forget about buying the Counting Crows album--never
mind that the link is purple because three days earlier I was browsing
for samba music.

No, you remember that you were there 3 days ago, so you can only scan
purple links when looking music section, and you are there faster than
without. After music link, you may see links like:

rock
rumba
samba

And wonder if you already looked the rock section. Or come back next day,
and wonder which one was it, which you followed yesterday.

If you don't know how to categorize music (like me), or music you wish to
buy don't categorize well (also me), knowing where you have been helps
you find 'new' content, or 'old' content. But it is just a hint, you can
easily ignore it, when looking specific content.
I didn't *say* it was *never* useful. Read my message again and note
what it was I was responding *to*--Jukka's absolutist rant about it
always being important for every link.
Apr 8 '08 #8

P: n/a
In article <66*************@mid.individual.net>,
Harlan Messinger <hm*******************@comcast.netwrote:
Lauri Raittila wrote:
in comp.infosystems.www.authoring.html, Harlan Messinger wrote:
If you don't know how to categorize music (like me), or music you wish to
buy don't categorize well (also me), knowing where you have been helps
you find 'new' content, or 'old' content. But it is just a hint, you can
easily ignore it, when looking specific content.

I didn't *say* it was *never* useful. Read my message again and note
what it was I was responding *to*--Jukka's absolutist rant about it
always being important for every link.
And in particular the nice image about the Konigsburg bridges. That was
worth something!

--
dorayme
Apr 8 '08 #9

P: n/a
in comp.infosystems.www.authoring.html, Harlan Messinger wrote:
I didn't *say* it was *never* useful. Read my message again and note
what it was I was responding *to*--Jukka's absolutist rant about it
always being important for every link.
Then why did you give example on case where it is useful? Give example
where it is worse than having it, and you might actually have some point.
--
Lauri Raittila <http://www.iki.fi/lr>
Apr 8 '08 #10

P: n/a
In article <MP************************@news.individual.net> ,
Lauri Raittila <la***@raittila.cjb.netwrote:
in comp.infosystems.www.authoring.html, Harlan Messinger wrote:
I didn't *say* it was *never* useful. Read my message again and note
what it was I was responding *to*--Jukka's absolutist rant about it
always being important for every link.

Then why did you give example on case where it is useful?
He didn't and it is as simple as that. Read his post again. Read about
his case of it being a nuisance that he misses out on paying attention
to buying the Counting Crows. Read it. Don't NOT read it and go on with
the argument that requires you to read it.
Give example
where it is worse than having it, and you might actually hav
--
dorayme
Apr 8 '08 #11

P: n/a
On Apr 8, 2:26*am, RobG <rg...@iinet.net.auwrote:
So remove empty whitespace after coding and before putting it on the
server.
apparently that is what I am doing now.
Allowing nested links is a particularly bad idea - if you have an
image in an A in an LI in a TR and the user clicks on the image, which
link should a browser follow?
I would take the inner most.
How do you click on a TR without clicking on a TR?
Sorry, I did not understand this question.
Apr 8 '08 #12

P: n/a
Harlan Messinger wrote:
The *advantage* of using an image is visual appeal
It goes beyond that.

In the example given earlier, if I see an image of the album art of the
album I want to buy, clicking on the album art is intuitive. I expect to
be able to click on the album art image to go to a page where I can
purchase the album. If the image is not a link, I might be confused
about what I should click on.
Apr 8 '08 #13

P: n/a
Scott Bryce wrote:
Harlan Messinger wrote:
>The *advantage* of using an image is visual appeal

It goes beyond that.

In the example given earlier, if I see an image of the album art of the
album I want to buy, clicking on the album art is intuitive. I expect to
be able to click on the album art image to go to a page where I can
purchase the album. If the image is not a link, I might be confused
about what I should click on.
Well ... if every album cover has a link beside it that reads "Buy this
album" I don't think you'll have any trouble. Nevertheless it's useful
to link the image as well.
Apr 8 '08 #14

P: n/a
Harlan Messinger wrote:
Well ... if every album cover has a link beside it that reads "Buy
this album" I don't think you'll have any trouble. Nevertheless it's
useful to link the image as well.
The first thing I think to do is click the image. If that does not work,
I look for a "Buy this album" link, which is usually an image that looks
like a button.

People will figure it out quick enough. I'm jut arguing that a clickable
image is sometimes more intuitive than a text link. The best option is
these cases is to provide both.
Apr 8 '08 #15

P: n/a
biju wrote:
>But why browsers dont support href attribute for <imgtag?

Whether at any time this came up at W3C?
Somewhat different yet similar question: why do some tags have a HREF
attribute (for example LINK) while others have SRC for the very same
purpose? Why is it not SRC for LINK?

Why does the OBJECT tag have neither but instead has a DATA attribute
for the URL?

--
Bart.
Apr 8 '08 #16

P: n/a
Scripsit Harlan Messinger:
In other words, if Barnes & Noble (bn.com) had simple text links for
Books, DVDs, Music, etc., and I went to their site to buy the Counting
Crows album that had just been released, and I discovered that the
Music links was purple, I would say, "Oh, I guess I've been to their
music page before" and forget about buying the Counting Crows
album--never mind that the link is purple because three days earlier
I was browsing for samba music.
Similarly, if you visit a news site and they have a link "Sports", which
is purple, you will apparently refrain from clicking on that link, since
you realize that you already saw the sports news. It's really up to you.

Others may use the color clue when they get acquainted with a news site
and wish to check all the major subpages - a useful idea. The color
clues help them see at a glance which subpages they already checked.

Links colors are very useful clues. There is always the option of
missing clues or faking to misunderstand them.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Apr 9 '08 #17

P: n/a
On Wed, 9 Apr 2008, Jukka K. Korpela wrote:
"Familienählichkeit"
Familienähnlichkeit
if someone might want to look up this word.

--
In memoriam Alan J. Flavell
http://groups.google.com/groups/sear...Alan.J.Flavell
Apr 9 '08 #18

This discussion thread is closed

Replies have been disabled for this discussion.