1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need to Link to an Image on another Page already containing multiple images

Discussion in 'HTML & Website Design' started by mark4man, Apr 9, 2018.

  1. #1
    hello again...

    I need to create a link on one page (my home page) that links directly to a image on another page already containing multiple images. Thought I knew how to do it...by creating an anchor; & my code looks like this:
    <a href="theOtherPage.html#PHOTO.png">IMAGE SUBJECT</a>
    
    HTML:
    but it doesn't work. Even tried the forward slash after the page id:
    <a href="theOtherPage.html/#PHOTO.png">IMAGE SUBJECT</a>
    
    HTML:
    but that doesn't work either. When the user clicks the link, I want the specific image to show up dead center (which I thought was an anchor)...anyone have any idea what I'm doing wrong?

    thanx,
    SEMrush
    mark4man
     
    mark4man, Apr 9, 2018 IP
    SEMrush
  2. hdewantara

    hdewantara Active Member

    Messages:
    422
    Likes Received:
    35
    Best Answers:
    18
    Trophy Points:
    80
    #2
    Hi.
    I believe it should work even if the image has an id="PHOTO.png" (same as name of the image itself). It will be visible when link clicked, but not as dead center.

    Well, if you also own the other page... you could make the image a bit centered:
    1. make a wrapper for this image,
    2. make the image centered, relative to its wrapper,
    3. and make this wrapper to have the id="PHOTO.png" instead?

    Just an idea :)

    Hendra
     
    Last edited: Apr 9, 2018
    hdewantara, Apr 9, 2018 IP
  3. mark4man

    mark4man Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #3
    No...sorry...didn't explain myself correctly...the image in question is already centered/positioned correctly on that 2nd page...don't need help w/ that...it's the link itself, not jumping to the image...the page is here:
    http://www.moonjams.net/events7.html
    I need to create links on my home page that go directly to *each* image on that 2nd page you see (there's 2 there now, but there will be more).

    thanx,

    mark4man
     
    mark4man, Apr 10, 2018 IP
  4. hdewantara

    hdewantara Active Member

    Messages:
    422
    Likes Received:
    35
    Best Answers:
    18
    Trophy Points:
    80
    #4
    I don't see any problems with a link like:
    <a href="events7.html#Layer2">IMAGE SUBJECT</a>

    Is there?
     
    hdewantara, Apr 10, 2018 IP
  5. mark4man

    mark4man Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #5
    Yes...both links I created take you to the top of the Events page, instead of the images themselves. That's ok for the 1st event image, which is located at the top of the page, but not the rest
     
    mark4man, Apr 10, 2018 IP
  6. mark4man

    mark4man Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #6
    sorry...page is at: http://www.moonjams.net/events.html
     
    mark4man, Apr 10, 2018 IP
  7. hdewantara

    hdewantara Active Member

    Messages:
    422
    Likes Received:
    35
    Best Answers:
    18
    Trophy Points:
    80
    #7
    Same principle man... for any regular HTML pages.
    Stupid question but perhaps just show me how you'd make link on homepage for 2nd image on events page... specifically?
    <a href="events.html#Layer8">IMAGE SUBJECT</a>
    or
    <a href="events.html#RBTR.jpg">IMAGE SUBJECT</a>
    ?
     
    hdewantara, Apr 11, 2018 IP
  8. mark4man

    mark4man Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #8
    hdewantara...

    The second one...to the image file itself (that's the way I did it, anyway). So...is that what the error is...do I instead need to direct it to the div?

    btw...ftm...thanx very much for helping me...I appreciate it; & everyone on my org's website committee appreciates it (as will the entire org soon).

    mark4man
     
    mark4man, Apr 11, 2018 IP
  9. mark4man

    mark4man Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #9
    hdewantara...FOLLOW UP...

    oh, man...missed that entirely...you already sorta indicated that in the prior post...missed it...will try now.
    thanx again,

    mark4man
     
    mark4man, Apr 11, 2018 IP
  10. hdewantara

    hdewantara Active Member

    Messages:
    422
    Likes Received:
    35
    Best Answers:
    18
    Trophy Points:
    80
    #10
    Cool ;)

    To be precise,... to any elements which has id attribute (see more in here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a).

    Cheers,
    Hendra D.
     
    hdewantara, Apr 12, 2018 IP
  11. mark4man

    mark4man Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #11
    Hendra D...

    It works (anchoring the 'div')...thanx! What's happening is, the referenced div appears at the top of the page. Keeping in mind that all the images on that page are already centered horizontally (left to right), is there any way to code the anchor so as to have the image in question also appear centered vertically (top to bottom)? (this would be the final piece to the puzzle).

    thanx again,

    mark4man
     
    mark4man, Apr 12, 2018 IP