473,385 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Why <img> tag dont have href attribute?

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
17 30565
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Philipp Lenssen | last post by:
My friend has the following problem (background: we want to transform XML to XHTML via XSLT): "We copy XHTML fragments into an output by using the following template: <xsl:template match="*"...
5
by: MyndPhlyp | last post by:
I've been busting my head trying to figure this out for quite some time. With IE6 and NS7, no problems. I can simply code the HTML <img height="100%"> and be done with it. But NS4 and NS6 (and...
2
by: David D. | last post by:
If an <IMG> specifies a WIDTH but not a HEIGHT, then height is internally determined so as to maintain the image's aspect ratio. Aspect ratio is also preserved if HEIGHT but not WIDTH is...
9
by: Wladimir Borsov | last post by:
As well known for <IMG ...> tags in web pages a width and a height attribute can be applied. What I want to do now is to fix the width for ALL the images on my web page to exactly lets say 70 pixel...
7
by: Zhang Weiwu | last post by:
Hello. This is problem puzzled me a long time. I wish to organize some block elements and let them flow one after each other like text. Think about a album, I wish the album have 12 thumbnails,...
8
by: KS | last post by:
Just to show some code to show the consept. <img id="date" onclick="javascript:show_calendar();" src="/PlexSysWeb/images/show-calendar.gif" width=20 height=18 border=0> What i want the...
15
by: Gérard Talbot | last post by:
Hello all, I'd like to know and understand the difference between, say, <img src="/ImageFilename.png" width="123" height="456" alt=""> and <img src="/ImageFilename.png" style="width:...
3
by: Henry Johnson | last post by:
Okay - I'm spinning my wheels on this one... can someone help me figure out how to programmatically populate a table cell as follows (from C# code-behind)? I've tried using a Literal control in the...
1
by: Carl | last post by:
Hi all I have a javascript function that drags and drops an element (ie img) into a container (ie bordered div). The function works and returns the element and and container. My next step is to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.