burger menu icon
WillMaster

WillMaster > LibraryWeb Page and Site Features

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Image Zoom on Hover

Wanted: When a mouse hovers over an image, the entire image becomes larger.

This article describes how to do an image zoom. It uses CSS. But no JavaScript.

Also of note is that this is a hover effect. That means a mouse pointer must be available to hover over the image. Generally, multimedia phones and tablets don't have a mouse pointer.

Here is a demonstration with the Willmaster logo. Hover your mouse over the logo, and the image will zoom into a larger size.

First, let's provide the CSS. Then you'll be able to use the CSS for any image on the web page.

<style type="text/css">
#image-zoom { transition: transform ease-in-out 0.7s; }
#image-zoom:hover { transform: scale(1.5); }
</style>

The 0.7s may be updated to the number of seconds that should elapse while the image is zoomed in or zoomed out.

The 1.5 may be updated to the zoom-in size that the image should zoom to.

You may, of course, change the class name (image-zoom). Every image using the class would then need to be updated accordingly.

With the CSS in place, any image tag can be given the id="image-zoom" attribute so it has the zoom feature.

Here is the image tag for the above example.

<img id="image-zoom" style="max-width:100%;" src="https://www.willmaster.com/images/wmlogo_icon.gif">

I think you'll find the zoom image relatively easy to implement.

(This article first appeared with an issue of the Possibilities newsletter.)

Will Bontrager

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2026 Will Bontrager Software LLC