Create BBC iPlayer style roll over boxes
// May 24th, 2009 // 3 Comments » // Code, css, tutorials
You must have seen those funky roll overs used on the BBC iPlayer website right? I have come up with a very basic way of doing the same thing, not with Javascript but with CSS and HTML.
Step One
First we need to prepare our image, so open your image editor of choice (I am using Fireworks for this example) and create a new canvas with a width of 178px and height of 200px. In the top half of the canvas place an image with a width of 178px and a height of 100px.

Now we make a copy of the image by selecting it and copying it. Paste it into the lower half of the canvas like below:

Then we add a black rectangle over the bottom image and reduce it’s opacity to around 80%
image

Finally add some text

Step 2 – The Code
Lets start with some really basic and easy mark up
<div class="content">
<a href="#"></a>
</div>
</div>
and our css…
.box .content a { display: block; width: 178px; height: 100px; background: url(images/heroes.jpg) no-repeat top left;}
.box .content a:hover {background-position:bottom left;}
all we have done is move the bottom half of the image up on the hover state to cover the top half of the image by setting a background position. Easy!
You should get something like this:



