Mouseover images with CSS
Sometimes we need mouseover effect for two images or more. For pure-css image galleries with thumbnail or comparison of before-later photos or photoshop effects like dark-light etc... Be sure that all images have same image width-height. We use an empty container with fixed width-height. We set the first image as background and the second one as hover-background. Demo
Example page code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Mouseover Images with CSS</title>
<style type="text/css">
div.hover_images {
float: left;
height: 120px;
width: 90px;
border: 1px solid #abc;
background: url(image1.jpg) no-repeat; background-position: center;
}
div.hover_images:hover {
background: url(image2.jpg) no-repeat;
background-position: center;
}
</style>
</head>
<body>
<h1>Mouseover Images with CSS</h1>
<div class="hover_images"></div>
<p> This is an example, how to use two background-images to make javascript-like mouseover effect. We use two background-images; the second one appears just when mouse comes over div-area.
</p>
</body>
</html>
| Attachment | Size |
|---|---|
| Download this example: mouseover_image_css.zip | 9.52 KB |
Similar entries
- Web 2.0 Style two Side Background, Dark to Light Effect
- Pure CSS Mouseover Menu without Javascript
- Web2 Style CSS Dynamic Menu with Arrows and Background-Images
- DropDown / Rollover Menu with pure CSS / HTML
- Preload images with JavaScript or CSS
- Common HTML / Web colors
- Free Banners : 468 x 60
- Photo Album / Picture Gallery Script with PHP
- Change background color onmouseover with Javascript
- Image watermark with PHP
- Web2 style secure & flexible free php contact form with easy setup
- Basic HTML Table with rounded corners
- Upload multiple images with PHP
- Bing vs. Google: a small comparison
- Smart Multi-Uploader and Thumbnail Creator from GIF/ JPEG/ PNG with PHP
- CSS Text effects for MSIE
- Cool Drupal Themes with preview to download directly
- A simple website structure
- High tech design/ layout rules
- Remove underline from text-links (html-tag a)

Comments
Post new comment