Adding background image to button using CSS - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Button

Description

Adding background image to button using CSS

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.button {<!--   w ww  .j  av  a  2s.  c om-->
   padding:11px;
   margin-right:9px;
   margin-bottom:11px;
   text-shadow:0 2px 2px Chartreuse;
   display:inline-block;
   white-space:nowrap;
   line-height:2em;
   position:relative;
   outline:none;
   overflow:visible;
   cursor:pointer;
   border-radius:5px;
   -moz-border-radius:5px;
   -webkit-border-radius:5px;
   box-shadow:2px 2px 3px 0 yellow;
   -moz-box-shadow:2px 2px 3px 0 blue;
   -webkit-box-shadow:2px 2px 3px 0 pink;
}

.button_about {
   background:url('http://www.java2s.com/style/demo/Google-Chrome.png') 4px 6px no-repeat;
   padding-left:36px;
   padding-right:16px;
}

.button_blue {
   border:2px solid WhiteSmoke;
   color:OrangeRed;
   background-color:grey;
}

.button_blue:hover {
   color:BlueViolet;
   opacity:0.10;
   filter:alpha(opacity=91);
}
</style> 
 </head> 
 <body> 
  <p> <a class="button button_blue">Without Background</a> </p> 
  <p> <a class="button button_blue button_about">With Background</a> </p>  
 </body>
</html>

Related Tutorials