Set hyperlink to image class??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shivup
    New Member
    • Aug 2012
    • 1

    Set hyperlink to image class??

    Hello Guys,

    Is there any way I can set hyperlink to a image which is in image class in css?

    for ex.
    I have this

    <div class="thumbnai l"><a href="/test/test1.php"><img src="/images/covers/test.jpg" alt="test" class="bkmrk" /></a>

    and here is my css file

    .thumbnail {
    float: left;
    width: 20%;
    text-align: center;
    margin-bottom: 20px;
    }

    .thumbnail img {
    height: auto;
    width: 95%;
    max-width: 150px;
    padding-top: 20px;
    }

    .thumbnail .bkmrk {
    background: url(/images/gold-bookmark.png) no-repeat 15px top;
    }

    and my output is



    is there any way I can set an hyperlink to this gold-bookmark.png image.. when i click on gold-bookmark.png it should take me somewhere (for ex. google.com) and when i click on actual test.jpg it should take me to /test/test.php.. It seems impossible to me.. let me know if you have any solutions how to do it.. I am willing to do any necessary changes since output will be the way I want..


    thank you
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I'm not sure what you're getting at. You don't need any CSS to make an image act like a hyperlink. You already have the HTML for that.

    Comment

    • ariful alam
      New Member
      • Jan 2011
      • 185

      #3
      in a div create two div vertically. set first inner div's height 15% that contain the golden ribbon image and second inner div's height to 85% that contain the actual image. so, you can add individual link to both the image.

      Comment

      Working...