In CSS3, we can create a photo gallery which, on rolling over the thumbnail image, displays the big image, along with it's description. The output of this tutorial would show only in Webkit and Mozilla browsers, and was not found to be supported in IE browsers (upto IE8). Kindly rollover to view the image and it's description.












The steps followed to create the above gallery are shown below.
We create a 'main' div to contain the gallery and the container for the images, respectively
|
#prod_disp_gal_main { width:454px; background-color:#000000; }
#prod_disp_gallery |
|
#prod_disp_gallery ul {margin:0 px; list-style:none; padding:0px; width:56px; float:left; margin:5px 0px; height:270px; } |
|
#prod_disp_gallery:hover ul { background-color:#000000; } |
Here we shall also provide main placeholder for the small images
|
#prod_disp_gallery ul li { list-style:none; display:inline; width:50px; height:36px; } |
In this step we give style to the individual placeholder of our images. In the beginning, before hovering, we use the property 'visibility:hidden' to hide our images
|
#prod_disp_gallery ul li a { width:50px; height:36px; text-decoration:none; visibility:hidden; -webkit-transition-duration:0.5s; opacity:0; padding:4px 0 4px 0; display:block; overflow:hidden; } |
|
#prod_disp_gallery ul li a img { width:50px; height:36px; padding:3px 3px 0px 3px; border:0px; } |
|
#prod_disp_gallery:hover a { opacity:1; overflow:hidden; visibility:visible; } |
In this step we assign a placeholder for the big image. In the beginning, it is placed to the extreme left, so that it doesnt show before hovering.Style for the same is shown below.
|
#prod_disp_gallery ul li a b
{ position:absolute; left:-9999px; display:block; width:360px; height:280px; margin-top:1px; } |
Now, on hovering the small image, we want our respective big image to show, for which the style is given as:
|
#prod_disp_gallery ul li a:hover b { position:absolute; left:0; top:5px; z-index:100; } |
Next,we give a style to the big image placed inside b, before hovering.
|
#prod_disp_gallery ul li a b img
{ width:auto; height:auto; } |
|
#prod_disp_gallery ul li a:hover b img { width:auto; height:auto; margin-left:9px; } |
|
#prod_disp_gallery ul li c
{ position:absolute; left:-9999px; display:block; width:150px; height:256px; background-color:#000000; visibility:hidden; } |
Here the description is again positioned to the extreme left, before hovering as shown above. On hovering, we assign the style to it so that it positions itself, after the div for small images as:
|
#prod_disp_gallery ul li a:hover c { position:absolute; left:432px; top:5px; z-index:100; padding:7px; visibility:visible; background-color:#000000; } |
|
<div id="prod_disp_gal_main"> <div id="prod_disp_gallery"> <img src="images/prod_disp_cover1.jpg" alt="" align="left" style="margin:5px 0 0 8px; background-color:#333333; padding:4px;" /> <ul> <li> <a href="#"><img src="images/prod_disp_pic1.jpg" /> <b><img src="images/prod_disp_pic1.jpg" /></b> <c class="header"> <span>Papayas<br/> <br/> <span class="content">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio </span> </span> </c></a></li> <li> <a href="#"><img src="images/prod_disp_pic2.jpg" /> <b><img src="images/prod_disp_pic2.jpg" /></b> <c class="header"><span >Oranges <br/> <br/> <span class="content">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio </span> </span> </c></a></li> <li> <a href="#"><img src="images/prod_disp_pic3.jpg" /> <b><img src="images/prod_disp_pic3.jpg" /></b> <c class="header"> <span >Strawberries <br/> <br/> <span class="content" >Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio</span></span> </c></a></li> <li> <a href="#"><img src="images/prod_disp_pic4.jpg" /> <b><img src="images/prod_disp_pic4.jpg" /></b> <c class="header"> <span >Grapes <br/> <br/> <span class="content">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio</span></span> </c></a></li> <li> <a href="#"><img src="images/prod_disp_pic5.jpg" /> <b><img src="images/prod_disp_pic5.jpg" /></b> <c class="header"> <span >Oranges <br/> <br/> <span class="content">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio</span></span> </c></a></li> <li> <a href="#"><img src="images/prod_disp_pic6.jpg" /> <b><img src="images/prod_disp_pic6.jpg" /></b> <c class="header"><span >Peaches <br/> <br/> <span class="content">Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio</span></span> </c></a></li> </ul> </div> |
Tags: Pure CSS3 photo gallery with description