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 Preface Lua Script nignx.conf c...
The default firewall of CentOS7 is not iptables, ...
async function and await keyword in JS function h...
Table of contents 1. Project folder structure 1. ...
html ¶ <html></html> html:xml ¶ <h...
Table of contents Preface Related Materials Vue p...
Table of contents 1. Prototype chain inheritance ...
Sometimes you need to use links, but you don't...
1. Oracle is a large database while MySQL is a sm...
Table of contents 1. Lock and Latch 2. Repeatable...
1. Check the currently installed PHP packages yum...
When the front-end requests the interface, it is ...
Preface In the previous article Two data types in...
Table of contents 1. substring() 2. substr() 3.in...
This is a very simple pure CSS3 white cloud float...