Use CSS filter to write mouse over effect <div class="filter-div"> <img class="filter-img" src="../assets/images/01list.png"/> </div> <style> .filter-div { width: 67px; height: 50px; background: #fff; &:hover { background: #5d7aae; } } .filter-img { width: 67px; height: 50px; &:hover { filter: brightness(100); } } </style> No Hover before the mouse is placed After the mouse is placed, there is a Hover The CSS filter:brightness(100) is used here to apply a linear multiplication to the image, making it appear brighter or darker. If the value is 0% or 0, the image will be completely black. A value of 100% results in no change to the image. Other values correspond to a linear multiplier effect. Values over 100% are possible, and the image will be brighter than before. If no value is set, the default is 1. If you want to dye the image white, the value is 100. Because the traditional hover method changes the src of img, the image will flash white when it is hovered for the first time, because the image needs to be reloaded. The advantage of this method is that the image only needs to be loaded once. Of course, this method also has limitations. You are welcome to correct me. This is the end of this article about using CSS filters to write examples of mouse rollover effects. For more relevant CSS filter mouse rollover 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! |
<<: VMware Workstation Pro 16 License Key with Usage Tutorial
To remove the underline of a hyperlink, you need t...
This article uses an example to illustrate how to...
1. Introduction Presto is an open source distribu...
Table of contents 1. The direction of this in the...
Preface Since many friends say they don’t have Ma...
There are many form elements. Here is a brief sum...
Starting from this section, we will explain the i...
A Docker container starts a single process when i...
1. Two ways to specify the character set of the h...
I won’t go into details about the theory of UDP. ...
In CentOS7, when we install MySQL, MariaDB will b...
Table of contents 1 Use of v-if and v-show 2. Dif...
Preface In order to ensure the consistency and in...
HTML is the abbreviation of Hypertext Markup Langu...
Table of contents 1. Description of functions in ...