CSS button hover background style child - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Button

Description

CSS button hover background style child

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Darkening an image with :hover</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

.btn-img {<!--from   w  w w.j  ava 2 s  . c  o 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;
}


      </style> 
 </head> 
 <body> 
  <button class="btn-img"> 
   <div class="img-wrap"> 
    <img src="https://www.java2s.com/style/demo/Firefox.png" alt="Dubai"> 
   </div> </button>  
 </body>
</html>

Related Tutorials