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 (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 37 of 41 pages « First  <  35 36 37 38 39 >  Last »

The site isn't finished, but I put up the problem page so you can take a look.
http://www.sandstoneairnoise.com/services2.html
The second thumbnail I preserved the original size and it works. The rest I re-sized to 640x480 and just blow out to a large green box. :-/
Thanks for your help!
Posted by ALS on 02/17, 01:12 PM
ALS -

Give this a try - I see that your ginormous image that does show, the jpeg extension is capitalized, yet all the others our lowercase:

The image that shows -

img/services/Ferry Departing 2.JPG

the others -

img/services/EveryOtherImage.jpg

Yes, that does make a difference, believe it or not, I learned this the frustrating hard way too. So, check and see if your images' jpeg extension in your 'services' folder, whether they are a capital .JPG, or lowercase .jpg, and then change whichever it is, to whatever they are, in your gallerycontainer code.

Hope that is it and does the trick for you.
Posted by JPH on 02/17, 01:47 PM
Nope. No luck. I can't believe something so simple deletes the whole image. May I ask what are the dimensions of the pics you used in the example?
Thanks!
Posted by ALS on 02/17, 02:13 PM
Hahaha! I got it! They were showing up the whole time, but I just couldn't see them because I changed the hover span to the left instead of the right!
I'm still laughing at myself 15 minutes later!
Thanks so much for your patience!
Posted by ALS on 02/17, 02:24 PM
Yay! Good for you!

All the best to you!
Posted by JPH on 02/17, 02:27 PM
Thanks for this very nice script. The problem lots of user have commented, is that they want to place their hover image next to the thumb. Like as the example. But this doesn't work, despite having position:relative.

Well: i have the (simple) solution. Just implement the css code above your head opening in the html, and don't make an external stylesheet. Offcourse you can create and external stylesheet: but then its possible you have the problem as I described!

Good luck.
Posted by Elloro Design on 03/14, 08:36 AM
I thought this was working in IE at one point, but no longer. It works perfectly in firefox and opera. Can anyone help? I'm really new at the whole css thing, so I'm guessing by embedding the thumbnails and .gallerycontainer in other div elements may be creating the problem (inherited properties?).

http://www.bluelucystudios.com/gallery.html
Posted by Ryan on 03/16, 08:34 AM
Works on Windows IE, but lands on the left of where it should in Safari, Opera and Firefox on Mac.
Posted by Bengt Stenstrom on 03/16, 10:28 AM
(Sorry, wrong mailadress in last message)
Works on Windows IE, but lands on the left of where it should in Safari, Opera and Firefox on Mac.
Posted by Bengt Stenstrom on 03/16, 10:44 AM
Bengt Stenstrom - is your response referring to my post? I can't get any of the larger images to appear at all in IE on a PC.

http://www.bluelucystudios.com/gallery.html
Posted by Ryan on 03/16, 11:40 AM

Comment Pages 37 of 41 pages « First  <  35 36 37 38 39 >  Last »

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