Step 1:Create index.html file and implement as below code in it.
<img src="../image/d1.jpg" alt="demo1" width="170" height="100"> <img src="../image/d2.jpg" alt="demo2" width="170" height="100"> <img src="../image/d3.jpg" alt="demo3" width="170" height="100">
Step 2:Implement CSS code as below to set opacity for image.
<style>
body {
background: #c7254e;
}
img {
opacity: 0.5;
}
img:hover {
opacity: 1.0;
}
</style>
Complete Code For Applying Opacity On Mouse Over To Image Using CSS .
<!DOCTYPE html>
<html>
<head>
<title>How To Apply Opacity On Mouse Over To Image Using CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<style>
body {
background: #c7254e;
}
img {
opacity: 0.5;
}
img:hover {
opacity: 1.0;
}
</style>
<body>
<br/><br/>
<div class="container">
<br>
<div class="text-center">
<h1 id="color" style="color: white;">Apply Opacity On Mouse Over To Image Using CSS</h1>
</div>
<br>
<div class="well">
<img src="../image/d1.jpg" alt="demo1" width="170" height="100">
<img src="../image/d2.jpg" alt="demo2" width="170" height="100">
<img src="../image/d3.jpg" alt="demo3" width="170" height="100">
</div>
<br>
</div>
</body>
</html>