skip to content
Website Builder

A Two Step Photograph Gallery

© 2009 stu nicholls - css play

CSS play Support


CSS play Recommend

PSD to HTMLSitegrinderuk white label shopping carts for resellersFree, practical CSS menus, layouts, and examples



Information

Another simple gallery that does not use thumbnail images. Because all the images are preloaded I have used the full size images as the thumbnails (displaying them at one fifth linear scale).

The first step is the hover which produced a half linear size image, then if you click the hover area it will produce a full size image that will stay on screen until you move your mouse off the gallery and click again.
The next half size image will display on top of the previous full size image, and so on...

Works in IE6, IE7, IE8, Firefox and Opera but Safari(PC) and Google Chrome do not not understand active or focus in the same way as other browsers so do not hold the clicked image on screen.

Cascading Style Sheet

a, a:visited, a:hover,  a:active, a:focus {font-weight:normal;} /* for IE6 */

ul#gallery {
  padding:0; 
  margin:100px auto; 
  width:448px; 
  height:336px; 
  position:relative; 
  background:#888 url(graff/g26.jpg);
  }
#gallery li {
  list-style-type:none; 
  width:64px; 
  height:48px; 
  float:left; 
  z-index:100;
  }
#gallery li.lft {
  float:left; 
  clear:left;
  }
#gallery li.rgt {
  float:right; 
  clear:right;
  }
#gallery a {
  position:relative; 
  width:64px; 
  height:48px; 
  display:block; 
  float:left; 
  z-index:100; 
  cursor:default;
  }
#gallery a img {
  position:relative; 
  width:62px; 
  height:46px; 
  border:1px solid #888; 
  z-index:100;
  }
#gallery a:hover {
  width:160px; 
  height:120px; 
  padding:108px 144px; 
  position:absolute; 
  left:0; 
  top:0; 
  z-index:20;
  }
#gallery a:hover img {
  background:#eee; 
  position:relative; 
  width:160px; 
  height:120px; 
  border:0; 
  z-index:20;
  }
#gallery a:active, #gallery a:focus {
  background:transparent; 
  width:320px; 
  height:240px; 
  padding:48px 64px; 
  position:absolute; 
  left:0; 
  top:0; 
  z-index:10;
  }
#gallery a:active img, #gallery a:focus img {
  background:#eee; 
  position:relative; 
  width:320px; 
  height:239px; 
  border:0; 
  z-index:10;
  }
/* hack for Internet Explorer */
#gallery li.pad {
  height:0; 
  display:block; 
  margin-top:-2px; 
  width:448px; 
  font-size:0;
  }

XHTML

<ul id="gallery">
<li><a href="#nogo">
<img src="graff/g1.jpg" alt="#1" title="#1" /></a></li>
<li><a href="#nogo">
<img src="graff/g2.jpg" alt="#2" title="#2" /></a></li>
<li><a href="#nogo">
<img src="graff/g3.jpg" alt="#3" title="#3" /></a></li>
<li><a href="#nogo">
<img src="graff/g4.jpg" alt="#4" title="#4" /></a></li>
<li><a href="#nogo">
<img src="graff/g5.jpg" alt="#5" title="#5" /></a></li>
<li><a href="#nogo">
<img src="graff/g6.jpg" alt="#6" title="#6" /></a></li>
<li class="rgt"><a href="#nogo">
<img src="graff/g7.jpg" alt="#7" title="#7" /></a></li>

<li class="lft"><a href="#nogo">
<img src="graff/g8.jpg" alt="#8" title="#8" /></a></li>
<li class="rgt"><a href="#nogo">
<img src="graff/g9.jpg" alt="#9" title="#9" /></a></li>
<li class="lft"><a href="#nogo">
<img src="graff/g10.jpg" alt="#10" title="#10" /></a></li>
<li class="rgt"><a href="#nogo">
<img src="graff/g11.jpg" alt="#11" title="#11" /></a></li>
<li class="lft"><a href="#nogo">
<img src="graff/g12.jpg" alt="#12" title="#12" /></a></li>
<li class="rgt"><a href="#nogo">
<img src="graff/g13.jpg" alt="#13" title="#13" /></a></li>
<li class="lft"><a href="#nogo">
<img src="graff/g14.jpg" alt="#14" title="#14" /></a></li>
<li class="rgt"><a href="#nogo">
<img src="graff/g15.jpg" alt="#15" title="#15" /></a></li>
<li class="lft"><a href="#nogo">
<img src="graff/g16.jpg" alt="#16" title="#16" /></a></li>
<li class="rgt"><a href="#nogo">
<img src="graff/g17.jpg" alt="#17" title="#17" /></a></li>

<li class="pad"></li>

<li class="lft"><a href="#nogo">
<img src="graff/g18.jpg" alt="#18" title="#18" /></a></li>
<li><a href="#nogo">
<img src="graff/g19.jpg" alt="#19" title="#19" /></a></li>
<li><a href="#nogo">
<img src="graff/g20.jpg" alt="#20" title="#20" /></a></li>
<li><a href="#nogo">
<img src="graff/g21.jpg" alt="#21" title="#21" /></a></li>
<li><a href="#nogo">
<img src="graff/g22.jpg" alt="#22" title="#22" /></a></li>
<li><a href="#nogo">
<img src="graff/g23.jpg" alt="#23" title="#23" /></a></li>
<li class="rgt"><a href="#nogo">
<img src="graff/g24.jpg" alt="#24" title="#24" /></a></li>
</ul>



Copyright

You may use this method on your personal 'non-profit' web site without seeking my permission. A link back to CSSplay is always appreciated.

Commercial usage is also permitted without seeking approval, but I would ask that a donation is considered to support my work on CSSPlay.

If you are having problems integrating any of my demonstrations into your website then I now offer a service to fault find and correct any errors that you may have introduced. Please email me for more information.




CSS play Recommend

CSS play Testimonial

"The citroen.co.uk web site uses
CSS play code for the site drop down menus.
This code works seamlessly in IE 6 & 7, and is an excellent solution to the Creative requirements of the site."

Damon Clark - Brandwidth