Why is the title of the article “Imitation Magnifying Glass”? Okay, let’s get back to the topic. What I want to talk about today is the animation of enlarging the picture at its original location when the mouse moves in ! The first thing that came to mind was the @keyframes attribute of CSS3, because it is used more often. For example: You can achieve this through transition ( today's focus ) Prophet: CSS3 attribute transform——(rotate: rotate, scale: scale, skew: skew, translate: translate) For example: Doesn’t it look very stiff? Let's take a look at the effect of adding transition: After looking at the difference between the two effects, you probably understand the role of the transition attribute. The goal of this example is similar to the width change, but the final effect is changed. Please continue to look at the detailed code below: <div id="container"> <img src="./little_boy.jpg" /> <span>Hello everyone! Who am I? </span> </div> #container { margin: 200px; position: relative; width: 300px; height: 300px; background-color: greenyellow; transition: transform .5s ease-out; } #container img { width: 100%; height: 100%; } #container span { position: absolute; top: 0; left: 0; margin: 6px; width: 100%; height: 20px; line-height: 20px; font-size: 18px; color: white; text-align: center; } #container:hover { transform: scale(1.3); } Analysis: This concludes this article about the principles and analysis of several ways to simulate a magnifying glass effect in CSS3. For more relevant CSS3 magnifying glass content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: Summary of commonly used tags in HTML (must read)
>>: Specific use of MySQL window functions
Table of contents 1. When the mouse passes over t...
In the official MySQL dump tool, how can I restor...
Preface This article records a problem I encounte...
Preface: Sometimes, the session connected to MySQ...
Table of contents 1. Usage of DATETIME and TIMEST...
Preface I accidentally discovered that the half-h...
This article example shares the specific code of ...
Table of contents 1. js statement Second, js arra...
Preface This is a new function I came across rece...
1. Command Introduction The file command is used ...
This article shares the specific code of js to ac...
This article uses examples to illustrate the prin...
Preface Using css to generate dotted lines is a p...
Table of contents 1. World Map 1. Install openlay...
Using cutecom for serial communication in Ubuntu ...