Log in

View Full Version : Help for a CSS beginner



millerjonm
06-24-2010, 06:25 PM
Hello,

I recently came across Dynamic Drive while searching for a way to put a better product image gallery code into a template. My goal was to create a product image gallery which contained 15 thumbnail images and that would have a larger image "pop out" when a thumbnail was hovered on.

The code I found on Dynamic Drive is as follows:


<style type="text/css">

/*Credits: Dynamic Drive CSS Library */
/*URL: dynamicdrive dot com slash style */

.gallerycontainer{
position: relative;
left: 55px;
/*Add a height attribute and set to largest image's height to prevent overlaying*/
}

.thumbnail img{
border: none;
margin: 0 5px 5px 0;
/*originally said border: 1px solid white;*/
}

.thumbnail:hover{
background-color: transparent;
}

.thumbnail:hover img{
border: none;
/*originally said border: 1px solid black;*/
}

.thumbnail span{ /*CSS for enlarged image*/
position: absolute;
background-color: transparent;
padding: 5px;
left: -1000px;
border: none;
visibility: hidden;
color: black;
text-decoration: none;
/*originally said border: 1px dashed gray; background-color: lightyellow;*/
}

.thumbnail span img{ /*CSS for enlarged image*/
border-width: 0;
padding: 2px;
}

.thumbnail:hover span{ /*CSS for enlarged image*/
visibility: visible;
top: 120px;
left: 380px; /*position where enlarged image should offset horizontally*/
z-index: 50;
}

</style>

The challenge I'm running into is this: I have hardcoded the template to have 15 thumbnail image places. However, the # of images per product varies greatly - some have 15, while others have 2 or 3.

So, I thought I could use 1-pixel transparent gifs in unused thumbnail image slots, and that the code (above) would simply have some invisible places in the thumbnail grid I've laid out - furthermore, that the pop-out images of these spacer.gif's would also be invisible.

Unfortunately, that's not the case - it renders the spacer.gif's as 110-pixel white images in the thumbnail grid, and it renders the pop-out spacer.gif's as white images as well.

Can someone please help me figure out how to make the unused thumbnail image spaces be blank, so that if I have 3 images, the code (above) displays 3 images but makes the remaining thumbnails invisible (and makes those invisibile thumbnail's pop-outs also invisible)?

Thank you sincerely,
Jon

millerjonm
06-24-2010, 07:15 PM
Well folks, I don't know how you did it, but it's working now - someone on the forums must have waved their magic wand!!!

THANK YOU! :)

-Jon