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

    macaddict23

    Joined:
    Jun 20, 2006
    Location:
    MacVille, USA
    #1
    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

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    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

    design-is

    Joined:
    Oct 17, 2007
    Location:
    London / U.K.
    #3
    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