Align h1 before and after background - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:h1-h6

Description

Align h1 before and after background

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">
.test {<!-- w w w  . j  a v a 2  s . c om-->
   border:2px solid Chartreuse;
   width:1001px;
   height:201px;
}

h1 {
   text-align:center;
   font-size:23px;
   font-weight:bold;
   color:yellow;
   margin:0 0 33px 0;
}

h1:before {
   float:left;
   text-align:left;
   background-image:url('http://www.java2s.com/style/demo/Google-Chrome.png');
   background-repeat:no-repeat;
   background-position:center left;
   padding:0 353px 0 0;
   content:"\1a0";
}

h1:after {
   float:right;
   background-image:url('http://www.java2s.com/style/demo/Google-Chrome.png');
   background-repeat:no-repeat;
   background-position:center right;
   padding:0 181px;
   content:"\1a0";
}
</style> 
 </head> 
 <body> 
  <div class="test"> 
   <h1>Test</h1> 
  </div>  
 </body>
</html>

Related Tutorials