Advanced Search Usage Terms Submit Contact
Dynamic Drive CSS Library
 
CSS Library

Advertise Here

CSS Layouts
Web Graphics
Online Tools:

CSS Library: Image CSS: Here

CSS Image Gallery

Author: Dynamic Drive

This is a purely CSS based image gallery that displays larger versions of thumbnail images dynamically when the mouse hovers over them. A rich HTML caption can be added to the enlarged image, and every aspect of the Image Gallery exists as plain HTML on the page. The idea is to use CSS's ":hover" pseudo class to cause an element to react onMouseover. When that happens, an absolutely positioned container holding the enlarged image, anchored on the page by another container with position set to relative, is shown. Furthermore, it's possible to modify the behavior so the enlarged images are only shown onClick, though IE6 currently doesn't support this behavior well. The gallery works in IE6+, Firefox, Opera 8+.

Demo:

Note: Here the enlarged images are set to "overlay" any content that it may come in contact with. You can easily disable overlaying just by giving the gallery container (.gallerycontainer) a height set to that of the largest image's.

The CSS:

The HTML:

Code Info

Rate this code:

Date Posted: 05/07/2006

Revision History: None

Usage Terms: Click here

Your Comments (406)

Got a question or need help customizing this CSS code? Post it in the CSS Forums. If you have a comment or suggestion instead, post it in the comments section below.

Comment Pages 4 of 41 pages « First  <  2 3 4 5 6 >  Last »

Rosemary,
I think if you use the CSS as shown any content including text in the location of the enlarged image will be overlayed by the large image. If its not doing that add: z-index:50; to .thumbnail span
The z-index of 50 will keep it on top.
Posted by Terry on 07/20, 08:55 PM
Nice photo gallery. I like to see something like this made without Javascript.
Posted by Hrvoje on 07/22, 11:53 PM
Is it possible to have the thumbnail in one container and have the image load in a seperate one. Main problem is the image will overload the current container so I want to be able to put it in a seperate container. Thanks.
Posted by Dan on 08/02, 02:24 PM
This is fantastic and works well, the only problem that I have is that in IE the large picture shows to the right of the thumbnails but in FF it shows centered over the top of the thumbnails - is there a fix forthis?
Posted by Laura on 08/02, 03:04 PM
could I hyperlink the thumbnails?
Posted by Jef on 08/06, 05:38 PM
I tried the codes, but instead of showing in 2 rows, it came out as a single line. Please help.
Posted by kem on 08/08, 12:38 PM
im making a div overlay for myspace, how would i encorporate this onto myspace. where wud i add the z-index? to make it go on top of everything else.
Posted by checento on 08/08, 05:31 PM
I have been pulling out my hair for three weeks trying to find a picture gallery that
1. was IE compatible
2. used mouseover action
3. displayed the full size picture at the same spot rather than in a relative position
4. included a picture caption

I found this site this morning and in three hours had it formatted,colored, and working beautifully for my site.
this is fantastic....thank you!!
Posted by dd on 08/09, 12:10 PM
I have posted sometime 3 wks ago, just got back so write how I was pleased :). Once in a while, you just stumble in to something so simple but totally blows you away. This css replaced a hundred lines or so of javascript I used for a dhtml floatie. Simple great..
Posted by jessie on 08/11, 11:49 AM
Excelent. Thanks.
Posted by Andrzej-Ludwik Wloszczynski on 08/12, 01:47 PM

Comment Pages 4 of 41 pages « First  <  2 3 4 5 6 >  Last »


Commenting is not available in this weblog entry.
Copyright 2006-2014 Dynamic Drive Read our Usage Terms before using any of the CSS codes.