HTML Element Style How to - Darken an image with :hover


We would like to know how to darken an image with :hover.


<!DOCTYPE html>
<style type='text/css'>
.btn-img {<!--from  w ww. j a va 2s .  co  m-->
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  background-color: white;
  outline: 1px dotted blue;

.btn-img .img-wrap {
  margin: 10px;

.btn-img img {
  display: block;

.btn-img:hover .img-wrap {
  background-color: black;

.btn-img:hover img {
  opacity: 0.8;
  <button class="btn-img">
    <div class="img-wrap">
        src="" />

The code above is rendered as follows: