Can I link to image in CSS?

Discussion in 'CSS' started by akinak, Aug 27, 2008.

  1. #1
    I want to put a hyperlink to an image which is placed using CSS. Is there any way of doing it?
     
    akinak, Aug 27, 2008 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    Since the only images css can insert are background, and since the background cannot gain focus, the answer is no.

    Make the image a part of the foreground, then there is no problem. eg.
    <p>
      <a href="#"><img src="some.png" alt="alternative text"></a>
    </p>
    Code (markup):
    cheers,

    gary
     
    kk5st, Aug 27, 2008 IP
  3. akinak

    akinak Peon

    Messages:
    256
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, it is inserted as a background image. It is not feasible for me to put the image in foreground. I have a large website and all the pages have this image. So if I change it to foreground, I'll have to change all the pages in my website. Isn't there any other way out?
     
    akinak, Aug 27, 2008 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    If you're going to make all those links anyway, what's the difference? It is what it is.

    cheers,

    gary
     
    kk5st, Aug 27, 2008 IP
  5. luckybee

    luckybee Peon

    Messages:
    151
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    luckybee, Aug 27, 2008 IP
  6. akinak

    akinak Peon

    Messages:
    256
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thank you all for your help..
     
    akinak, Aug 28, 2008 IP
  7. feha

    feha Active Member

    Messages:
    1,005
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    80
    #7
    feha, Aug 29, 2008 IP
  8. mypsdtohtml

    mypsdtohtml Guest

    Messages:
    96
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    You cannot link from an image from CSS because CSS use background images, just add the <a> link inside your XHTML
     
    mypsdtohtml, Aug 30, 2008 IP