Set inline div with background image and text - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Text

Description

Set inline div with background image and text

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">
.cn_header {<!--from  w  w w .  ja v  a  2  s .  co m-->
   background:Chartreuse;
   height:25px;
   line-height:25px;
   padding:6px;
}

.print {
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png');
   display:inline-block;
   height:25px;
   width:25px;
   vertical-align:middle;
}
</style> 
 </head> 
 <body> 
  <div class="cn_header"> 
   <div class="print"></div>Lorem ips 
  </div>  
 </body>
</html>

Related Tutorials