Advanced Search Usage Terms Submit Contact
Dynamic Drive CSS Library
 
CSS Library
Submit an original CSS code
CSS Layouts
Web Graphics
Online Tools:

Advertise Here

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 (316)

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 30 of 32 pages « First  <  28 29 30 31 32 >

Hi
I managed to change the hover into a click by adding this to the CSS code:
.thumbnail:active img{
border:1px white;
}

.thumbnail:active span{ /*CSS for enlarged image*/
visibility: visible;
top: 0;
left: 230px; top:0px; /*position where enlarged image should offset horizontally */
z-index: 50;
white-space: nowrap;
}

I removed the 'hover' tags as both creates an overlay of images.
Thank you to someone here on page or so of the comments for the tip of 'whitespace:nowrap' as that worked for me too.
Posted by Sophie on 09/26, 02:21 AM
This is a great css gallery!

Do you know how you can add the functionality of a click change instead of a hover change? Or do I need to add JS for that?
Posted by Belinda on 09/29, 08:51 PM
when i apply this, images are not displaying how can i do this better. Is there any code has been written for this............. Plz send me an email how could i do it
Posted by sai charan on 10/10, 03:42 AM
hello, great tool, but I need to implement a link to another web page as I do, someone can help me, thanks
Posted by Remisero on 10/13, 03:12 PM
I have extra space at the bottom of the page I just can't seem to get rid of since I added the above css and html code. Help would be highly appreciated! Thank you. Great code BTW.
http://www.topekametal.com/equipment.html
Posted by Tim on 10/14, 09:17 PM
GREAT!
1. Can the enlarged image be set to float at a fixed screen position as the page is scrolled by the user to get to more thumbs?

2. Is there a way to list my thumbs vertically but with smaller space between them [vertically]? The creates too much verical space.
Posted by joel on 10/17, 09:13 AM
well i got one question! will this work on myspace.com?
Posted by david on 10/17, 03:52 PM
Is it go in IE 6
Posted by Wetter on 10/19, 05:15 AM
This works well in Firefox, but not Internet Explorer. Have I gone wrong somewhere?
Posted by Lucy on 10/22, 04:22 AM
Hey!! thanks allot dear,

Your code works fine, you have saved alot of my work
I though of plugging a gallery using flash for which i needed to do alot of home work.

Surely you saved alot of time , Thanks for sharing this fine peice of code.


Thanks Dude :)
Posted by Srini shining on 10/26, 07:03 AM

Comment Pages 30 of 32 pages « First  <  28 29 30 31 32 >

Name: (Required)

Email: (Required)

(NOT shown on page)

URL:

(Shown on page if entered)

Comments: (Required)

Supported BB codes: [b], [i], [u], [em], [strike], [strong], [pre], [code], and [blockquote].

Remember my personal information
Notify me of follow-up comments?

Submit the word you see below ("previewing" post does not require it):


Copyright 2006-2008 Dynamic Drive Read our Usage Terms before using any of the CSS codes.
Dynamic Drive DHTML and CSS Code Library