Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use html+css to realize the Special effects of Image Scanner

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use html+css to achieve image scanner special effects. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Achieve:

1. Define a box:

two。 Basic style, length and width background and so on.

.tu {width: 500px; height: 300px; background-image: url (8.jpg); background-size: 100% auto; background-repeat: no-repeat; position: relative; overflow: hidden; cursor: pointer;}

Cursor: pointer; mouse over box style is small hand

3. Use pseudo-class elements as scan lines, basic styles:

.tu:: after {content:'; position: absolute; top: 0; left: 0; width: 500px; height: 35px; background-image: url (8.jpg); background-size: 100% auto; background-repeat: no-repeat; filter: sepia (100%) Opacity: 0;}

Filter: sepia (100%); the picture is yellow.

Filter: invert (100%); like X-ray film.

4. Implement scanning:

.tu: hover::after {opacity: 1; animation: move 1.8s linear infinite;} @ keyframes move {0% {top: 0; background-position: 6px 0px;} 20% {top: 60px; background-position:-6px-60px } 40% {top: 120px; background-position: 6px-120px;} 60% {top: 180px; background-position:-6px-180px;} 80% {top: 240px Background-position: 6px-240px;} 100% {top: 300px; background-position:-6px-300px;}}

Let the y-axis displacement of background-position be exactly equal to the distance of top, and then if the x-axis is 0, it will not shake, and if there is a value, it will wobble.

Complete code:

Document * {margin: 0; padding: 0; box-sizing: border-box;} body {height: 100vh; display: flex; justify-content: center; align-items: center; background-color: rgb (0,0,0) } .tu {width: 500px; height: 300px; background-image: url (8.jpg); background-size: 100% auto; background-repeat: no-repeat; position: relative; overflow: hidden; cursor: pointer } .tu:: after {content:'; position: absolute; top: 0; left: 0; width: 500px; height: 20px; background-image: url (8.jpg); background-size: 100% auto; background-repeat: no-repeat Filter: invert; opacity: 0;} .tu: hover::after {opacity: 1; animation: move 1.8s linear infinite;} @ keyframes move {0% {top: 0; background-position: 6px 0px } 20% {top: 60px; background-position:-6px-60px;} 40% {top: 120px; background-position: 6px-120px;} 60% {top: 180px Background-position:-6px-180px;} 80% {top: 240px; background-position: 6px-240px;} 100% {top: 300px; background-position:-6px-300px }} this is the end of the article on "how to use html+css to achieve special effects for picture scanners". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report