Centering text with word spacing and background image - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Text

Description

Centering text with word spacing and background image

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">
h2 {<!--from   ww w .  ja  v a2s  .  c om-->
   display:inline-block;
   text-align:center;
   color:Chartreuse;
   word-spacing:41px;
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png') top center no-repeat;
   background-size:51px;
   padding:21px 0;
}

span {
   width:100px;
   display:inline-block;
   text-align:right;
}

span:nth-child(2) {
   text-align:left;
}
</style> 
 </head> 
 <body> 
  <div> 
   <h2> <span>Lore</span> <span>Lore</span> </h2> 
  </div>  
 </body>
</html>

Related Tutorials