First look at the effect: When the mouse moves over the image, add shadow effect + text/icon The key to implementation is CSS opacity and hover . This article also mainly introduces the implementation of the mask layer. <div class="img_div"> <img src="item.image_base64" @click="deleteImg" class="imgCSS"> <div class="mask"> <h3><Icon type="ios-trash-outline" size="40"></Icon></h3> </div> </div> CSS: [Deleted some codes not related to the implementation of the above picture] I think the key code is It should be pointed out that the purpose of pointer-events:none is to solve the problem that when there is an absolute positioning of the mask layer, clicking on the image cannot trigger an event, such as the deleteImg event in the code .img_div { border-radius: 10px; display: block; position: relative; } .imgCSS { height: 100%; width: 100%; border-radius: 10px; display: block; cursor: pointer; } .mask { position: absolute; background: rgba(101, 101, 101, 0.6); color: #ffffff; opacity: 0; top: 0; right: 0; width: 100%; height: 100%; border-radius: 10px; pointer-events:none; } .mask h3 { text-align: center; margin-top: 25%; } .img_div:hover .mask { opacity: 1; } This is the end of this article about how to implement the CSS mask layer effect when the mouse hovers over an image. For more relevant CSS mouse hover image mask layer content, please search 123WORDPRESS.COM’s previous articles or continue to browse the related articles below. I hope that everyone will support 123WORDPRESS.COM in the future! |
<<: Things You Don’t Know About the CSS ::before and ::after Pseudo-Elements
>>: Install Linux using VMware virtual machine (CentOS7 image)
Table of contents 1. Achieve results 2. Backend i...
1. Install tomcat8 with docker 1. Find the tomcat...
HTML operation principle: 1. Local operation: ope...
1. An error (1064) is reported when using mysqldu...
Disable SeLinux setenforce 0 Permanently closed: ...
Use of clip-path polygon The value is composed of...
Recently, due to the need to test security produc...
transform: scale(); Scaling will cause jitter in ...
How to add <script> script in HTML: 1. You c...
I have found a lot of online resources on this pro...
Creating a Cursor First, create a data table in M...
Table of contents The order in which MySQL reads ...
This article example shares the specific code of ...
<style type="text/css"> Copy code ...
Table of contents Preface 1. Create a new Vue pro...