How to enlarge the image by clicking the mouse in css3

青灯夜游
Release: 2022-04-25 16:52:38
Original
5361 people have browsed it

Implementation method: 1. Use the ":active" selector to select the state of the mouse click on the picture; 2. Use the transform attribute and scale() function to achieve the picture magnification effect, the syntax "img:active {transform: scale( x-axis magnification, y-axis magnification);}".

How to enlarge the image by clicking the mouse in css3

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

css3 realizes mouse click to enlarge the image

Implementation idea:

  • Use ":active" The selector selects the state of the mouse clicked image

  • Use the transform attribute and scale() function to achieve the magnification effect

Syntax:

img:active {transform: scale(2,2);}
Copy after login

Implementation example:

     
How to enlarge the image by clicking the mouse in css3
Copy after login

How to enlarge the image by clicking the mouse in css3

Description:

The English interpretation of active is "positive", which is reflected in Clicking on the mouse means clicking. The most common examples of the active selector are probably applied to links. However, opening a link is a momentary action, which does not reflect the characteristics of the active selector well.

TheTransform property applies a 2D or 3D transformation to the element. This property allows you to rotate, scale, move, tilt, etc. the element. When this attribute is used together with the scale() function, the attribute element will be scaled.

(Learning video sharing:css video tutorial,web front-end)

The above is the detailed content of How to enlarge the image by clicking the mouse in css3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!