How to link a picture in css

Discussion in 'HTML & Website Design' started by iimpact, May 14, 2008.

  1. #1
    .logo { 
    	background: #658AB4 url(./images/site_logo.jpg) no-repeat;
    	border: 1px solid #000000;
    	height: 140px;
    	width: 970px;
    }
    Code (markup):
    i would like this picture to become a link, how do i do this?
     
    iimpact, May 14, 2008 IP
  2. HDaddy

    HDaddy Active Member

    Messages:
    287
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #2
    You can´t link it in your stylesheet. You have to make it in html code. like this:

    <div class="logo">
    <a href="whatever.html" img src="yourimagefolder/yourimage.jpg" alt="describe image"></a>
    </div>

    You can style the anchor behaviour in the logo class in your stylesheet.
     
    HDaddy, May 14, 2008 IP
  3. iimpact

    iimpact Active Member

    Messages:
    407
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #3
    thnx a lot!!
     
    iimpact, May 14, 2008 IP
  4. ourblink

    ourblink Peon

    Messages:
    25
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Link is not allowed in CSS case ..:)
     
    ourblink, May 15, 2008 IP
  5. mmkrulz

    mmkrulz Peon

    Messages:
    197
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    that might not be W3C valid, try it this way instead:
    (It will look the same, just would be W3C valid, and would probably lessen the chance of it looking different in different browsers as well)

    <a class="logo" href="whatever.html"></a>
     
    mmkrulz, May 15, 2008 IP