hovering images.

Discussion in 'CSS' started by EnDLeSs_27, Nov 14, 2008.

  1. #1
    So I am trying to get an arrow to appear underneath a link once a mouse is hovering over it.

    I added the following css code

    ul#page_nav li a:hover {
    background: transparent url(/images/bg_topnav_hover.gif) no-repeat bottom center;
    }

    But once I go over the text with my mouse the image appears in the center of the text. It should appear in the center but underneath the text not on it.

    To make things more clear took a screenshot. [​IMG]. Anyone think they can help me out in getting the arrow appear directly underneath the text.
     
    EnDLeSs_27, Nov 14, 2008 IP
  2. EnDLeSs_27

    EnDLeSs_27 Active Member

    Messages:
    112
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #2
    I still don't know how to fix this. Anyone think they can assist me?
     
    EnDLeSs_27, Nov 17, 2008 IP
  3. katendarcy

    katendarcy Peon

    Messages:
    115
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'm not sure what your CSS code for your anchor tags is, but have you tried adding padding to the bottom? (Such as "a{padding-bottom:5px;}" or "a{padding:0px 0px 5px 0px;}", substituting the values you want for the padding.) What seems to be happening is that the image is indeed appearing where it's supposed to, at the bottom of the link. However, as links are inline elements, all the space it's taking up is what you're seeing. You could try "display:block" or "float:left" for the link, so that it takes up the whole li. Let us know if that works.
     
    katendarcy, Nov 17, 2008 IP
  4. EnDLeSs_27

    EnDLeSs_27 Active Member

    Messages:
    112
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Fixed it thanks a lot ;]

    I added the following code

    ul#page_nav li a {
    text-decoration:none;
    display: block;
    color: #FFFFFF;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    padding: 8px 8px 5px 1px;
    font-size: 12px;
    display:block
    }
     
    EnDLeSs_27, Nov 17, 2008 IP
  5. katendarcy

    katendarcy Peon

    Messages:
    115
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Cool. Glad it worked! (Not sure if it was a typo, but it looks like you have "display:block" listed twice. Just a heads up! ; ) Take care.
     
    katendarcy, Nov 17, 2008 IP