I tried to give my div and img element pseudo-class ::after when I hover them, but it's only work on the div element. It doesn't work with img element Any solution?
.element {
margin: auto;
max-width: 5.2rem;
height: 5rem;
border-radius: .75rem;
margin-top: .75rem;
position: relative;
background: red;
}
.element:hover::after {
content: "";
display: block;
width: 100%;
height: 100%;
position: absolute;
inset: 0;
background: rgba(255, 255, 255, .6);
z-index: 7;
border: 2px solid orange;
}
<div class="element"></div>
<div class="element"></div>
<div class="element"></div>
<img src="https://raw.githubusercontent.com/SAM-dev-pixel/fylo/main/img/illustration-intro.png" alt="" class="element">
<img src="https://raw.githubusercontent.com/SAM-dev-pixel/fylo/main/img/illustration-stay-productive.png" alt="" class="element">
<img src="https://raw.githubusercontent.com/SAM-dev-pixel/bookmark-landing-page/main/img/illustration-hero.svg" alt="" class="element">