CSS Library: Image CSS: Here
CSS Popup Image Viewer
Author: Dynamic Drive
Enable arbitrary links or image thumbnails to pop up an enlarged (different) image onMouseover by using this CSS code. With the help of CSS's ":hover" pseudo class, combined with relative and absolute positioning, the enlarged images are simply included on the page as normal HTML, "popping" up on demand. CSS is behaving more and more like scripting!
Demo:
One of my favorite foods is sushi
Doesn't this look good?, and it's good for you too! Coffee and sushi probably don't mix well, but I like some Zoka Coffee
Zoka Coffee to boot! Here are some thumbnails from my trip to La la land:
![]()

Simply beautiful.
![]()

So real, it's unreal. Or is it?
The CSS:
Got a question or need help customizing this CSS code? Post it in the CSS Forums. If you have a comment or suggestion instead, post it in the comments section below.
Comment Pages 8 of 53 pages « First < 6 7 8 9 10 > Last »
I want to app this to myspace.. i have a overlay on the (corp)myspace and only the images are displying not just thumb and it to mouse over etc.. but i will get it working hopefuly..
Thanks and I have created you as a favorite upon my links.. but you get the web bowser toolbar link .. your that special lol! Peace
There are blue lines all over the place, which of cause turn purple when visited.
Does any one know how to remedy that?
Thanks!
I have one problem with this though.. If someone could tell me .. If placed within a paragragh i place this code and after the codes end i still have my paragraph text to cont.. how do i continue it with out my text skipping a line and change colors lik the link.. I want it to revert right after the following and continue my paragraph.. it seems to be a simple closing and openening but where and what type..
Or use this generator... u will need firefox to use it http://www.layoutcodez.net/popmessage/
[<style type="text/css">.kmqkzpubspk {
display:block;
background-image:url('http://www.adamscandy.com/Images/Products/bigImg/black forest300.gif');
width:184px;
height:318px;
}
.kmqkzpubsp {
display: none;
}
a.kmqkzpubspl:hover {
border-width: 0;
}
.copyright {
font-size:8px;
font-weight:bold;
color:FFFFFF;
position:absolute;
top:-1px;
left:50px;
}
.kmqkzpubspl {
position: relative;
background-color: #444444;
text-decoration: none;
color: khaki;font-weight:bold;
}.kmqkzpubspl:hover .kmqkzpubsp {
display: block;
position: absolute;
width: 184px;
background-color: #444444;
padding: 1px 3px 2px 3px;
border: 1px 000 solid;
font-size: 0.8em;
left: 2em;
top: 0.5em;
cursor:default;
}
.kmqkzpubspl { cursor:default; }
</style>
<a class="kmqkzpubspl" href="http://www.adamscandy.com/index.cfm?page=Details&Product_ID=431">Black Forest<span class="kmqkzpubsp"><span class="copyright">Luke Says</span><div class="kmqkzpubspk"></div> These are the best Gummies on Earth... Always make a good present for birthday's .."hint ,hint!.." </span></a>]
I've worked out at solution to the stupid link decoration, which made my text below the picture look like sh.t!
Just add: text-decoration: none; like below
.thumbnail:hover{
background-color: transparent;
text-decoration: none;
z-index: 50;}
This should fix it!
But on a different PC the image only pops up when the user does a right mouse click and selects properties. Weird.
Also the position of the pop-up is lower in Firefox.
Any suggestions?
My advice is, that you work out a solution - a compromise - that fits both IE, Firefox, Opera etc. I think it is possible if you play with the padding-element of the css-code. There is a different response to padding with the two browser - this could do the trick. I hope this gives you the inspiration to make it work.
First:
put this line between the <head> and </head> section of your html:
<script type="text/javascript" src="dom-drag.js"></script>
Second: Go here and download the dom-drag.js and place it in the same directory as your main pages:
http://www.dynamicdrive.com/dynamicindex11/domdrag/
Third:
Use Luke's mod (where I took away the backgrounds)
<style type="text/css">
#galleryimage {
position: relative;
z-index:0;
}
.thumbnail {
display:block;
}
.thumbnail:hover{
position:relative;
}
.thumbnail span{ /*CSS for enlarged image*/
position: absolute;
background: transparent;
padding:5px;
left: -1000px;
border:1px transparent;
display:none;
}
.thumbnail span img{ /*CSS for enlarged image*/
padding:2px;
}
.thumbnail:hover span{ /*CSS for enlarged image on hover*/
display:block;
top:10px;
z-index: 50;
left: 10px;
}
</style>
and then add in the lines for the images itself. I used a slightly smaller thumbnail, removed the length resize because I'm using multiple images through a template, and I also took out the text in the popup as I want the visitor to be able to move the popup wherever they want.
<a class="thumbnail" href="#thumb">YOUR IMAGE URL
<span>YOUR IMAGE URL
</span></a>
<script type="text/javascript">
Drag.init(document.getElementById("book"));
</script>
On the 4th part I have the thumbnails to show up at 80 px wide and however long it works out to be. Put the path of the original image in the two YOUR IMAGE URL spots. I selected the img id to be called "books" because I'm displaying books.
I tried this on both IE6 & 7 but not yet Firefox. The popup, thumbnail, and ability to move the images can be seen at http://www.yesterdaysbookshop.com/testcss.htm
Credit goes to Luke and to Virgix. Of course, if this ends up not working in Firefox then I'm back to square one and javaville!








#galleryimage {
position: relative;
z-index:0;
}
.thumbnail {
display:block;
}
.thumbnail:hover{
position:relative;
}
.thumbnail span{ /*CSS for enlarged image*/
position: absolute;
background: #fff;
padding:5px;
left: -1000px;
border:1px solid #000;
display:none;
}
.thumbnail span img{ /*CSS for enlarged image*/
padding:2px;
}
.thumbnail:hover span{ /*CSS for enlarged image on hover*/
display:block;
top:10px;
z-index: 50;
left: 10px;
}
Seems to work great now. Before, even with the example posted by the author, the hover/popup image wouldn't render properly in Safari. I had to add display:block to the .thumbnail class, or else the image would pop up but be cut off on the ends.