0

I am wanting to use an image sprite for a hover action, but I've been working on it for an hour and can't get it right. The span element video-play-q-right has the sprite as its background.

Here is my sprite:

enter image description here

Here is a screenshot of the divs:

enter image description here

Here is the html:

    <div class="video-box">
         <div class="video-img">
             <a href="#" onclick="window.open('http://url.html','photoessay','scrollbars=no,resizable=yes,width=800,height=600')">
             <img src="resources-na/images/video.jpg" width="200" height="155" border="1">
             <span class="video-play-q-right">play</span></a>
        </div>
        <div class="video-text">
            <p><strong> of Water</strong>.<br /> water's properties. (05:43 min)
            <a href="#" onclick="window.open('http://url.html','photoessay','scrollbars=no,resizable=yes,width=850,height=722')">... View</a></p>
        </div>
    </div>

Here is the CSS:

.video-box{
    padding-right: 20px;
    float: left;
    width: 200px;
}
.video-img {
    background-color: #EEEEEE;
    border: 1px solid #DDDDDD;
    margin-bottom: 0 !important;
    padding: 4px;
    width: 200px;
    height: 155px;
}

.video-play-q-right {
    background: url("../images/video-play-q-big.png") no-repeat scroll 0 0 transparent;
    background-position: center top;
    height: 50px;
    position: absolute;
    text-indent: -9999em;
    width: 50px;
    left: 321px;
    top: 127px;
}

a.video-play-q-right:hover span{
    background-position: center bottom;
}
novicePrgrmr
  • 18,647
  • 31
  • 81
  • 103

1 Answers1

2

Why a.video-play-q-right:hover span ?

There's no link with video-play-q-right class. Try to replace it with a:hover .video-play-q-right


a.my-class:hover span means " a link (a element) with class my-class which contain a span ".

So it will target this:

<a href="..." class="my-class"><span>Some text</span></a>

But not this:

<a href="..."><span class="my-class">Some text</span></a>
Giona
  • 20,734
  • 4
  • 56
  • 68