Advertise here

CSSplay - :target Gallery with no 'history'

Fully working in Firefox, Safari and Chrome, partial in IE9+ and Opera

copyright © stu nicholls - CSS play

Information

A revamp of the previous gallery to use :target to keep the selected images on screen even when clicking elsewhere on the page.

This also has a small javascript routine to keep the browser history location on the page entry url so that when using the 'back' button you do not cycle back through the images.

Several people have asked if this is possible, so here is one answer to thequestion.

This fully works in Firefox, Chrome and Safari and parially works in IE9+ and Opera.

The code and stylesheet for this demo are both very simple and show how the normal jump to the top of the browser window is removed by having the :target elements with display:none; and then using the general sibling selector to 'target' the images and resize/repositon them.

So now we have :target with no jump and no browser 'back' button problems.



Copyright

Because of all the time and effort spent in producing this demonstration
I would ask that you respect my copyright.

  1. If you are using this on a personal web site then please add a link back to CSSplay and retain any copyright comment in the stylesheet.
    A donation to the 'Support CSSplay' fund would be appreciated.
  2. If you are using this on a commercial web site, or as a paying job for a client, then please email me asking for permission - stu{at}cssplay.co.uk and in this case a donation to the 'Support CSSplay' fund is required.
  3. 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.

  • Each week the Creare Group produce video tutorials for SEO and tips and tricks for the web design industry.

Recommended Sites


Please Support CSS play

CSS play Recommend

Free, practical CSS menus, layouts, and examples

Follow CSS play


Facebook   Twitter   Facebook Fan Page

Just CSS | Designs for the future

Like the CSS Zen Garden?
Then why not visit Just CSS and see it you can design for the future.