|
Hovering over the small image shows a bigger imageThis tutorial will show you how to display a larger image when you mouse over a smaller image. DemoHow it's doneThis is the relevant css
#picture {width:100px; height: 250px; background-color:#ffffff;}
And this is the relevant html
<div id="picture">
Let's look at the css and html that make the magnification happen.
#picture a .large {display:block; position:absolute; width:0; height:0; border:0; top:0; left:0;}
You are telling any links within the picture div, with the .large class specified, that they are to display as nothing! Take a look at the code. 0 width, 0 height, 0 border!! Any links with the .large class specified won't be seen UNLESS it’s hovered over AND has the .small and .large classes specified because you have a separate rule for "hover .small .large" which is:
#picture a.small :hover .large {display:block; position:absolute; top:-65px; left:150px; width:200px; height:200px;}
This tells the element that instead of being 0 x 0 in size it's to be 200 x 200 and voila! You can see the picture! Clever isn’t it! Magnify an image
<div id="picture">
As you will see from the html code above your anchor’s class is .small and your image class is .large. So if your link is hovered over then #menu a.p1:hover .large {display:block; position:absolute; top:-65px; left:150px; width:300px; height:300px;
Will apply. Anchowledgement goes to Stu Nicholl's CSS Play |