Why <img> tag dont have href attribute?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • biju

    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?
  • Harlan Messinger

    #2
    Re: Why &lt;img&gt; tag dont have href attribute?

    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.

    Comment

    • biju

      #3
      Re: Why &lt;img&gt; tag dont have href attribute?

      On Apr 6, 9:54 pm, Harlan Messinger
      <hmessinger.rem ovet...@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>

      Comment

      • Harlan Messinger

        #4
        Re: Why &lt;img&gt; tag dont have href attribute?

        biju wrote:
        On Apr 6, 9:54 pm, Harlan Messinger
        <hmessinger.rem ovet...@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.

        Comment

        • Andy Dingley

          #5
          Re: Why &lt;img&gt; tag dont have href attribute?

          On 7 Apr, 02:36, biju <bijumaill...@y ahoo.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.

          Comment

          • dorayme

            #6
            Re: Why &lt;img&gt; tag dont have href attribute?

            In article <aFuKj.322813$8 H6.216309@reade r1.news.saunala hti.fi>,
            "Jukka K. Korpela" <jkorpela@cs.tu t.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

            Comment

            • Lauri Raittila

              #7
              Re: Why &lt;img&gt; tag dont have href attribute?

              in comp.infosystem s.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>

              Comment

              • Harlan Messinger

                #8
                Re: Why &lt;img&gt; tag dont have href attribute?

                Lauri Raittila wrote:
                in comp.infosystem s.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.

                Comment

                • dorayme

                  #9
                  Re: Why &lt;img&gt; tag dont have href attribute?

                  In article <660p5pF2iauqrU 1@mid.individua l.net>,
                  Harlan Messinger <hmessinger.rem ovethis@comcast .netwrote:
                  Lauri Raittila wrote:
                  in comp.infosystem s.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

                  Comment

                  • Lauri Raittila

                    #10
                    Re: Why &lt;img&gt; tag dont have href attribute?

                    in comp.infosystem s.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>

                    Comment

                    • dorayme

                      #11
                      Re: Why &lt;img&gt; tag dont have href attribute?

                      In article <MPG.2265647a88 83bfbb98a770@ne ws.individual.n et>,
                      Lauri Raittila <lauri@raittila .cjb.netwrote:
                      in comp.infosystem s.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

                      Comment

                      • biju

                        #12
                        Re: Why &lt;img&gt; tag dont have href attribute?

                        On Apr 8, 2:26 am, RobG <rg...@iinet.ne t.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.

                        Comment

                        • Scott Bryce

                          #13
                          Re: Why &lt;img&gt; tag dont have href attribute?

                          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.

                          Comment

                          • Harlan Messinger

                            #14
                            Re: Why &lt;img&gt; tag dont have href attribute?

                            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.

                            Comment

                            • Scott Bryce

                              #15
                              Re: Why &lt;img&gt; tag dont have href attribute?

                              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.

                              Comment

                              Working...