Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

CSS Image Enlarger

Pada pembahasan kali ini saya masih akan mengangkat tema mengenai CSS. Nah kali ini CSS yang akan kita bahas adalah memperbesar image dengan CSS. Jadi image yang akan kita tampilkan disini dalam bentuk tumbnail, kemudian jika mouse diletakkan di atas image(mouseover), maka image akan membesar(enlarge) sesuai ukuran aslinya. Kode resize image diperlukan di dalam CSS guna meningkatkan tampilan dari contoh yang akan kita bahas ini.



Baiklah langsung saja, saya berikan kode CSS nya.

CSS Code



<style type="text/css">

/*Credits: Dynamic Drive CSS Library */
/*URL: http://www.dynamicdrive.com/style/ */
/*Re-translating by http://kipluxer.blogspot.com */
/* smart image enlarger starts here */
/* If your images are not linking to other pages leave the links as <a href="#nogo"> Otherwise enlarger won't work in IE6 */

.ienlarger {
float: left;
clear: none; /* set to left or right if needed */
padding-bottom: 5px; /* space between thumbs. Don't change this to margin */
padding-right: 5px; /* space between thumbs and wrapping text when there is any text around it */
}

.ienlarger a {
display:block;
text-decoration: none;
/* add cursor:default; to this rule to disable the hand cursor */
}

.ienlarger a:hover{ /* don't move this positioning to normal state */
position:relative;
}

.ienlarger span img {
border: 1px solid #FFFFFF; /* adds a border around the image */
margin-bottom: 8px; /* pushes the text down from the image */
}

.ienlarger a span { /* this is for the large image and the caption */
position: absolute;
display:none;
color: #FFCC00; /* caption text colour */
text-decoration: none;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px; /* caption text size */
background-color: #000000;
font-weight: bold;
padding-top: 10px;
padding-right: 10px;
padding-bottom: 13px;
padding-left: 10px;
}

.ienlarger img { /* leave or IE puts a border around links */
border-width: 0;
}

.ienlarger a:hover span {
display:block;
top: 50px; /* means the pop-up's top is 50px away from thumb's top */
left: 90px; /* means the pop-up's left is 90px far from the thumb's left */
z-index: 100;

/* If you want the pop-up open to the left of thumb, remove the left: 90px; and add
right: 90px; This would mean the right side of the pop-up is 90px far from the right side of thumb */

/* If you want the pop-up open above the thumb, remove the top: 50px; and add
bottom: 50px; This would mean the bottom of the pop-up is 50px far from the bottom of thumb */

/* add cursor:default; to this rule to disable the hand cursor only for the large image */
}

.resize_thumb {
width: 150px; /* enter desired thumb width here */
height : auto;
}

/* smart image enlarger ends here */

</style>



HTML code



<div class="ienlarger"><a href="http://kipluxer.blogspot.com/"><img src="cobaimage.jpg" alt="thumb" class="resize_thumb" /><span>
<img src="cobaimage.jpg" alt="large" /><br />
http://kipluxer.blogspot.com/</span></a></div>

<div class="ienlarger"><a href="http://kipluxer.blogspot.com/"><img src="image.jpg" alt="thumb" class="resize_thumb" /><span>
<img src="image.jpg" alt="large" /><br />
http://kipluxer.blogspot.com/</span></a></div>

<div class="ienlarger"><a href="http://kipluxer.blogspot.com/"><img src="image (1).jpg" alt="thumb" class="resize_thumb" /><span>
<img src="image (1).jpg" alt="large" /><br />
http://kipluxer.blogspot.com/</span></a></div>

<div class="ienlarger"><a href="http://kipluxer.blogspot.com/"><img src="image (2).jpg" alt="thumb" class="resize_thumb" /><span>
<img src="image (2).jpg" alt="large" /><br />
http://kipluxer.blogspot.com/</span></a></div>

<div class="ienlarger"><a href="http://kipluxer.blogspot.com/"><img src="image (3).jpg" alt="thumb" class="resize_thumb" /><span>
<img src="image (3).jpg" alt="large" /><br />
http://kipluxer.blogspot.com/</span></a></div>


<br style="clear:left" />




This post first appeared on Q-Learning, please read the originial post: here

Share the post

CSS Image Enlarger

×

Subscribe to Q-learning

Get updates delivered right to your inbox!

Thank you for your subscription

×