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 8887393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:47:52+00:00 2026-06-14T21:47:52+00:00

I would like to have a div that contains an image and some text

  • 0

I would like to have a div that contains an image and some text be a link. So that one can click anywhere (not necessarily the image or text) in the div and be taken to one location. However I would also like there to be another link at the end of the text that brings the user to another location. However, once I add this second link the whole div no longer is a link and just the image and text are links. Is what I am want to do possible?

  • 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-14T21:47:53+00:00Added an answer on June 14, 2026 at 9:47 pm

    It is not possible in HTML, since an a element inside an a element is not allowed. By existing HTML specs, you cannot have e.g, div inside a either, but this restriction was never really enforced by browsers and it has been lifted in HTML5 drafts. Nested a elements are a different issue, since it would create an active area inside an active, and its meaning would need to be defined and it would be confusing.

    What happens in practice when using

    <a href=foo>bla bla <a href=bar>inner link</a> stuff</a>
    

    is that it works the way you want except that content of the outer a element after the inner a element is not a link at all. Apparently browsers are not prepared to handling constructs like this. Effectively, they imply a closing </a> tag when they encounter an <a> tag when an a element is open. Much like they do for p elements.

    So an inner link at the end of a link would sort-of work. There is of course no guarantee that it will keep working in future versions of browsers, or that it works on all browsers.

    You could use two separate, non-nested a elements in succession and to place the second one visually inside the first one, using CSS positioning. But this would get somewhat complicated. A much simpler approach is to set up a JavaScript pseudo-link:

    <span onclick="document.location.href = 'foo'; return false">inner link</span>
    

    The downside is that it won’t act in a link-like manner when JavaScript is disabled, and search engines won’t treat it as a link either.

    • 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 some text inputs. I would like those text
I have a well div, and I would like to attach a small text/image
I have a div, which contains an image and a span. I would like
I have a container div that contains some img tags. When I click on
I have a div that contains some text and the div has a background
I have a div that I would like to reposition each time the page
I have a div which contains a number of images. I would like to
I have a container div, that contains many other divs, and in one of
I have a small menu div that i would like to keep in the
I have some some rows of image thumbs inside anchors inside a div, one

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.