Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS help with css sprite

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #31283
    cybershot
    Participant

    I am making a sprite for a button on my page. It looks like the button is working fine. I made it like so

    Learn More

    I gave the link a background image and then on hover, I move the image up 55px. All is good. For the text in the link, the “Learn More” I gave it a text-indent of 999px; but it is still showing on the screen. Isn’t it common practice to move it off screen with a large indent?

    #65471
    cybershot
    Participant

    thanks for that.

    One more question.

    I am trying to make a list of contact information. So I made a sprite with a mail, twitter, phone and facebook image. The idea is to show the mail then when they hover over the mail, it moves the sprite to show the hover image. I can’t figure out how to make a link with the hover image. This is what I am trying now



    ul#contactList li span#mail a:link {
    display: block;
    background: url(../images/social.png)0 0 no-repeat;
    width: 200px;
    height: 32px;
    }




    I have been trying different things. but the second image keeps showing up. I can’t figure it out.

    #65445
    jamygolden
    Member
    #contactList a{
    display: block;
    background: url(../images/social.png) no-repeat 0 0 left top;
    width: 200px;
    height: 32px;
    }
    #mail:hover{
    background-position: -15px -20px;
    }
    #contactList.phone a:hover{
    background-position: -25px -10px;
    }


    I’ve obviously used random numbers for the background position as I don’t have the sprite.

    #65425
    cybershot
    Participant

    that isn’t working. I thought it might have. It looked close.

    #65426
    cybershot
    Participant

    well, I almost got it working. It’s actually displaying nicely, the only problem is that the image doesn’t change when I am over the link. It only changes when i am over the span


    #contactList li a {
    display: block;
    line-height: 32px;
    text-decoration: none;
    color: white;
    margin-left: 36px;
    }

    #contactList li span#mail {
    float: left;
    display: block;
    background: url(../images/social.png) no-repeat left top;
    height: 32px;
    width: 31px;
    }

    #contactList li span#mail:hover {
    float: left;
    background: url(../images/social.png) no-repeat -32px 0;
    height: 32px;
    width: 31px;
    }




    #65429
    cybershot
    Participant
    #65432
    TT_Mark
    Member

    It doesn’t change when you are over the link, because you are not telling it to!

    If you look at your CSS code, you have a span:hover, but no a:hover

    #65434
    cybershot
    Participant

    well, I have gone through the code many times over the last few hours. What you saw was just one possible version. I am sure at one time I had the a:hover. I know you need it to make the change. My issue is that I couldn’t get it working that way because of the width properties

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘CSS’ is closed to new topics and replies.