---
title: "How to change the image opacity on hover in CSS?"  
description: "How to change the image opacity on hover in CSS?"  
author: "Ravi Vishwakarma"  
published: 2021-07-19  
canonical: https://answers.mindstick.com/qa/93777/how-to-change-the-image-opacity-on-hover-in-css  
category: "web application"  
tags: ["javascript", "css cascading style sheets", "html5"]  
reading_time: 1 minute  

---

# How to change the image opacity on hover in CSS?

How to change the [image](https://www.mindstick.com/blog/216/i-want-to-display-images-into-to-datagridview-one-by-one-taking-image-url-from-database-field) opacity on hover in [CSS](https://www.mindstick.com/articles/12349/a-step-by-step-guide-to-making-pure-css-tooltips)?

## Answers

### Answer 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>
```


---

Original Source: https://answers.mindstick.com/qa/93777/how-to-change-the-image-opacity-on-hover-in-css

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
