IMG Hover

Discussion in 'CSS' started by Richard K, Mar 11, 2008.

  1. #1
    I use that code in my style coding to make an image hover on WWE Divas.

    The thing is there are some images I don't want the hover to be on, so is there some sort of coding I can use on images so that the hover doesn't come up? Or a code that allows me to choose which images I want to have the hover on?

    Help is appreciated :)
     
    Richard K, Mar 11, 2008 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    You can either toss a class on the ones you don't want to hover setting it back to normal - in the CSS just be sure to declare that class AFTER... or put a class on the ones you want to hover... In general though, you shouldn't be assigning that to ALL images, just inherit off the parent container.

    THOUGH I'm assuming these are anchors? If so you should probably inherit the hover state off the anchor and not on the IMG itself, since IE6/earlier won't hover.
     
    deathshadow, Mar 11, 2008 IP
  3. Richard K

    Richard K Guest

    Messages:
    462
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Could you give me the codes I need please? :)
     
    Richard K, Mar 11, 2008 IP
  4. nicangeli

    nicangeli Peon

    Messages:
    828
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #4
    
    <!-- When you hover over the first two, they will change -->
    <img src="/path" alt="" class="yes">
    <img src="/path" alt="" class="yes">
    <!-- the last will not, becuase the class="yes" is not applied -->
    <img src="/path" alt="">
    
    HTML:
    and the css.

    
    img {
    border: 1px solid #191919;
    }
    
    img.yes:hover {
    border: 1px solid #a61717;
    cursor: pointer;
    }
    
    
    Code (markup):
    But that won't work in IE6 or below, you need to do as deathshadow suggests.
     
    nicangeli, Mar 13, 2008 IP