How to change the image opacity on hover in CSS?

0 votes
53 views
Ravi Vishwakarma asked 11 days ago in Web Application by Ravi Vishwakarma

How to change the image opacity on hover in CSS?

1 Answer

1 votes
Ethan Karla answered 8 days ago by Ethan Karla
<!DOCTYPE html>

<html lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
    <meta charset='utf-8' />
    <title></title>
    <style>
        img:hover {
            opacity: 0.5;
        }
    </style>
</head>
<body>
    <img src='heart.png' />
</body>
</html>