Text in Alt tag is not Displaying

Discussion in 'PHP' started by tanmay.kamath1992, Dec 25, 2013.

  1. #1
    I have a blog on wordpress. I have uploaded the image and inserted my keywords in the alt tag of my logo. But it is not displaying .
    
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
               <img src="<?php echo esc_attr( $logo ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" id="logo" alt="keywords"/>
             </a>
    
    Code (markup):

     
    tanmay.kamath1992, Dec 25, 2013 IP
  2. jk.deff

    jk.deff Active Member

    Messages:
    59
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    55
    #2
    Use "title":
    <a title="..." href="..."
     
    jk.deff, Dec 25, 2013 IP
  3. tanmay.kamath1992

    tanmay.kamath1992 Member

    Messages:
    203
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    35
    #3
    Oh Why didn't i thought of that lol
    Thx :p
     
    tanmay.kamath1992, Dec 25, 2013 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Alt-attributes are to be shown when the actual element (in this case an image) is not shown - either because it's not at the source-location, or because someone has decided to browse with images turned off. Hence, the alt-text should be descriptive of the image, so the context can be understand regardless of having the image there or not.
     
    PoPSiCLe, Dec 26, 2013 IP