Youtube like Image Overlapping
Posted: 05 November 2008 07:16 PM   [ Ignore ]
Newbie
Rank
Total Posts:  2
Joined  2008-11-05

Hi, I’m new in css and I’d like to know how can I do something like this.
Plese take a moment to watch the image

http://img5.xooimage.com/files/7/8/4/youtube-7dc1d4.gif

Over all thumbnails appear a “plus” sign, and it contains a link to diferent location than the main thumbnail

I think is about overlaping images. The plus sign over the thumbnail but I don’t know an css way of doing it

Can you suggest me something


Thanks a lot in advance

Profile
 
 
Posted: 14 November 2008 11:32 AM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  8
Joined  2008-11-14

By the looks of it these clever guys at you tube use a ‘master’ transparent gif with all of their icons on it. This in itself is not how the effect is achieved but I did find the method quite interesting.

You tube do some 1pixel image technique to force the <a> tag to the top. I’m not going to go into how this works but for the example it’s not really important. The simple way to achieve this would be to have a css class which places the ‘master’ transparent gif as the background image and width/height dimensions to match the required icon, for the <a> this changes on :hover (pseudo class). You can then position the <a> tag over the image tag using negative margins or absolute positioning.

A simplified version of the markup and style might look like this:

Markup

<img class="vimg120" alt="video" title="The Little Girl Who Was Forgotten" src="http://i3.ytimg.com/vi/rLz1xyFMMCQ/default.jpg"/><a title="Add Video to QuickList" class="QLIconImg"></a

note it’s the class that is important here

CSS

a.QLIcon {
margin
:-25px 0 0 -200px;
height:25px;
width:25px;
background:transparent url(http://s.ytimg.com/yt/img/master-vfl62437.gif) no-repeat scroll -537px 4px;
}

a
.QLIcon:hover {
background
-position:-562px 4px;

This achieves a quick way to change the appearance of the background image without loading any more data, as the whole icon set is saved in the browser cache.

Here is a good explanation of the technique: http://www.wellstyled.com/css-nopreload-rollovers.html

If you don’t already use this setup I would highly recommend it for web development - Firefox with the Firebug Add On installed, it has saved me so much time and hairloss it’s fantastic.

Web developer toolbar add-on for FF is also immensely useful too.

Profile
 
 
Posted: 18 November 2008 06:55 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  2
Joined  2008-11-05

Thanks for your answer, but I don’t manage to make it work


This what I see and I don’t find a way to get it in the right place
Screen


The idea of using a master gif is something new for me and is very clever indeed I think it reduces the page load time by reducing the number of request to the server

I don’t know what is my mistake

Thanks a lot!!!

Profile
 
 
Posted: 18 November 2008 07:07 PM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  8
Joined  2008-11-14

Hi pascualito,

Yeah thats right it will reduce the number of calls to the server.

Your problem seems to be positioning the a tag correctly over the image. Can you host the file online and send me a link? I can fix your problem then.

Profile