Skip to main content

How to use CSS Sprites.

I am not a web designer but i needed to show a before and after state for my restoration images. I had originally started with 2 images 'before' and 'after' side by side. This achieved the goal but didn't really give any wow factor.

I then tried a roll-over technique where holding the mouse over the image loads up a different one. But that meant the second image didn't load until the mouse was placed over it.

The solution was to use a CSS  sprite. This loads just one image made up of the before and after images. The clever bit is that the code only displays one half of the image. When the mouse is moved over it it shifts the image's position on the page to show the other half. But as it is still ALL one image it doesn't require any time to load it. Instant before and after states. Below is the original image and the CSS code I used. You can see the final result on the restoration page




You can see the final result on the restoration page

<-!
<center><style>#BIKE
{
  displayblock;
  width215px;
  height300px;
  backgroundUrl(http://www.pixelfix.co.nz/resources/Bikesprite.jpgno-repeat 0px 0px
border-style:solid;
border-width:7px;
border-color:#FFFFFF;
}

#BIKE:hover

  background-position-215px 0px;
}

#BIKE span
{
  displaynone;
    }
</style>
<id="BIKE" href="#" title="BIKE"><span>BIKE</span></a></center>


​->

Comments

Popular posts from this blog

Happy New Year

Happy New to everyone I hope this year will bring another lot of amazing restorations. Below is a short slideshow of past photo restorations completed by us at PixelFIX using Adobe  Photoshop, some patience and a little bit of skill you will be amazed at what is possible.  PixelFIX - Photo restoration and photos repaired, from $15. The restoration and manipulation specialists. Click here for 'fancy view'

Restoring badly torn photograph

This has to be one of the most satisfying restorations done to date. The original was torn into many pieces and required extensive Photoshop work to be painstakingly pieced back together. The original scan was the key to making this a successful restoration and invisibly repairing the ripped pieces into one full image again. PixelFIX - Photo restoration and photos repaired, from $15. The restoration and manipulation specialists. Click here for 'fancy view'

Where did he go?

via WordPress https://ift.tt/2PSTF8B #photorestoration #Photo #instagram #beforeandafter #blackandwhite #restored #auckland #genealogy #oldphoto #colorize #colourised #familytree #instahistory #silvering #photoshop #recolor #recolour #familyphoto #photorepair #photofix #soldier #wwi #anzacday #anzac #familyphotography #history #nz