1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: alt tags not working

Discussion in 'Web Design & Development' started by chrissy1955, Dec 30, 2010.

Thread Status:
Not open for further replies.
Advertisement
  1. chrissy1955

    chrissy1955 Thread Starter

    Joined:
    Jan 29, 2010
    Messages:
    51
    Hi. I am trying to do an alt tag but it sits permanantly to the side of the image whereas it should float over the image when i hover the mouse.

    <a href="joeshome.html"> Home <img src="iceberg.jpg" border="5" alt="Home" height="100" width="150"></a>
    <br>
    <a href="joesproduce1.html"> Produce <img src="cos.jpg" border="5" alt="Produce" height="100" width="150"></a>
    <br>
    <a href="joeshistory.html"> History <img src="fancy.jpg" border="5" alt="History" height="100" width="150"></a>


    These are the html codes for the 3 images I am using unsuccessfully. Where am I going wrong?:(

    many thanks
     
  2. ehymel

    ehymel

    Joined:
    Aug 12, 2007
    Messages:
    696
    Are you *sure* that's what is happening? Try this code instead and tell us what you get:

    Code:
    <a href="joeshome.html"><img src="iceberg.jpg" border="5" alt="Home" height="100" width="150"></a>
    <br>
    <a href="joesproduce1.html"><img src="cos.jpg" border="5" alt="Produce" height="100" width="150"></a>
    <br>
    <a href="joeshistory.html"><img src="fancy.jpg" border="5" alt="History" height="100" width="150"></a>
    
     
  3. sepala

    sepala

    Joined:
    May 20, 2010
    Messages:
    4,038
    Hi Chrissy1955,

    Seems like you are repeating the same mistake which you have done in here
    http://forums.techguy.org/web-design-development/971520-solved-learning-html-links.html

    This code is meaningless. Either you have to finish the <a> before jumping to the <img> or you have to give a image link. I am not correcting the code code because ehymel has already done that.

    But I need to say something else.
    This is a correct HTML code but a wrong XHTML code. The simple meaning of the XHTML is "well formed HTML". You have to close the <img> tag, even it has no closing tag. Close it like this.

    <img src="iceberg.jpg" border="5" alt="Home" height="100" width="150" />
     
  4. ehymel

    ehymel

    Joined:
    Aug 12, 2007
    Messages:
    696
    Sepala,
    Chrissy's html code is correct, I'm not sure why you are saying she has to close the <a> tag before going on to the <img> tag. She did that! I think what happened is that she is perhaps confusing the text next to the image as the alt tag. I suggested removing the text and see if this is the desired result.

    I don't think she ever specified using xhtml code, certainly not everyone uses that. Depends on her doctype specifications of course. The html code as written is just fine.
     
  5. chrissy1955

    chrissy1955 Thread Starter

    Joined:
    Jan 29, 2010
    Messages:
    51
    Thanks guys, I have copied and pasted in E html codes. I see that the difference is the word home was sitting in there between the <a and before the <img....that has now taken away the word which was a ling to another page. I can see that if I hover over the image down in the bottom left hand corner of the screen it tells me that if I click it will take me to the page I want it to take me, however when the hand comes up when hovering, i would expect to see the word, home, produce or history depending on the image I am hovering above but this still does not happen, any further ideas?
     
  6. ehymel

    ehymel

    Joined:
    Aug 12, 2007
    Messages:
    696
    What browser are you using? Sounds like you are looking for the "title" attribute in firefox.

    Code:
    <a href="joeshome.html"><img src="iceberg.jpg" border="5" alt="Home" title="Home" height="100" width="150"></a>
     
  7. sepala

    sepala

    Joined:
    May 20, 2010
    Messages:
    4,038
    In her code, Both text, and picture, act as a link because of this

    <a href="joeshome.html"> Home <img src="iceberg.jpg" border="5" alt="Home" height="100" width="150"></a>

    Normally we are not doing that isn't it? If she need that, no problem. But I think she need to give an image link, that's why I tell that. Anyway I am not talking about ORDER OF TAG CLOSING(I think you thought I am talking about this).

    Yes, XHTML is not mandatory, But I can't agree with you with this
    Most people use this, But I know most beginners don't use it, but it is advisable to use that because that is a standard of W3C(Anyway technology is something we can round up! )

    Yes, that's why I said this is a correct HTML but wrong XHTML
     
  8. chrissy1955

    chrissy1955 Thread Starter

    Joined:
    Jan 29, 2010
    Messages:
    51
    I have removed both the word home in the href part and then the actual alt="home". It seems that the alt="home" is having absolutely no effect.

    Yes I am certainly a beginner an not farmiliar with xhtml

    all help greatly appreciated
     
  9. sepala

    sepala

    Joined:
    May 20, 2010
    Messages:
    4,038
    If the web browser is not supporting to images or if image option is disabled, then the things inside the ALT will be displayed. That is why we use it.
     
  10. chrissy1955

    chrissy1955 Thread Starter

    Joined:
    Jan 29, 2010
    Messages:
    51
    I undeerstand that but I also thought the word "Home" (in my scenario) should be shown when I hover - perhaps this is where I am going wrong?
     
  11. chrissy1955

    chrissy1955 Thread Starter

    Joined:
    Jan 29, 2010
    Messages:
    51
    I am using Internet explorer
     
  12. chrissy1955

    chrissy1955 Thread Starter

    Joined:
    Jan 29, 2010
    Messages:
    51
    I have just used title="home" and found that works - ye ha - thanks
     
  13. sepala

    sepala

    Joined:
    May 20, 2010
    Messages:
    4,038
    There is another way to do that, that is using <anchor title="">. This is used when you are not using <a>.
    example
    <anchor title="sdfnkfgnkdfng"><img src="Andermatt-1.gif" alt = "Andermat"/></anchor>

    This will work on FireFox, and all other browsers which is using NetsCape Navigator Technology
     
  14. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/971702

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice