How do I make a text link that target an image?

Discussion in 'Web Design and Development' started by macaddict23, Apr 6, 2009.

  1. macaddict23 macrumors 6502


    Jun 20, 2006
    MacVille, USA
    Let me explain what I'm trying to achieve. I have three text links (LINK 1, LINK 2, LINK 3). By default, IMAGE 1 shows up on my page. But if a user clicks on "LINK 2," then IMAGE 2 replaces IMAGE 1 above. How do I make this happen with CSS?

    Thanks in advance!
  2. angelwatt Moderator emeritus


    Aug 16, 2005
    For CSS, it would be better to detect when a user hovers over a link to change an image. JavaScript is what should be used to detect mouse clicks. CSS can handle what you want to an extent by using the pseudo selector :active, but I don't really advise it. A link should go to a page or take a user to another spot on the page.
  3. design-is macrumors 65816


    Oct 17, 2007
    London / U.K.
    Here's a site with an example of a 'click to view' image gallery that might be useful to you in figuring out a solution.

Share This Page