Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8683757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:07:38+00:00 2026-06-12T22:07:38+00:00

I have a div that contains an image with text and a button over

  • 0

I have a div that contains an image with text and a button over layed on top of it. The text is positioned absolute and will cover the entire image. At the end of the text will also be a button. I am trying to get the image to be a link, but I am having problems doing so.

My current solution involves wrapping both my image and text within an a tag. This doesn’t work as when the user tries to click the button, they would click the link instead of the button. I also have tried wrapping just my img tag inside the a tag, but since my text is positioned on top, the link will never be registered as being clickable.

http://jsfiddle.net/NxtWa/

HTML:

<div class="tile">
    <a href="http://www.google.ca">
        <img src="http://www.placehold.it/480x260">
        <div class="text">
            <p>Long long paragraph</p>
            <button>Button</button>
        </div>
    </a>
</div>

CSS:

.tile { position:relative; width:480px; height:260px; }
.tile .text { position:absolute; top:0px; left:0px; width:480px; height:260px; }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:07:40+00:00Added an answer on June 12, 2026 at 10:07 pm

    I assume you are positioning the text and button over the image using z-index property. You will have to percolate the click event down to the image by using a suitable event-watcher/event-handler pattern so that the appropriate clicks for the text and button are handled through them and those which need to go down to the image are passed on further by the event handler for the image/button.

    Related question with a possible solution: JavaScript pass mouseenter event to element that is underneath another element

    On more research, this technique is called event bubbling (Sorry the term had slipped my mind earlier). Additional help on how to get this done @ https://stackoverflow.com/a/1026101/17716

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div that contains 3 fields You can see the image here
I have a div that is position: absolute and it contains items that get
I have a <div /> that contains a image and a anchor. The anchor
I have a div that contains an image with a width of 100%, I
I have some jQuery that hides half a div that contains an image and
I have a simple HTML button which contains text and an image: HTML: (Already
I have a div with id=images. The div contains some images that are each
I have a div that contains a list of messages (it's a chatroom application).
I have a div that contains a ul and in each li there is
I have a div that contains two other divs,, like this: ---------------------------- | |

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.