position heading in the center of the page - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

position heading in the center of the page

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">
.header .wrap {<!--   w w w. j a  va 2 s. co  m-->
   border:2px solid Chartreuse;
   width:100px;
   margin:auto;
   text-align:center;
   position:relative;
}

.header .wrap .img_1, .header .wrap .img_2 {
   border:2px solid yellow;
   position:absolute;
   height:21px;
   width:21px;
   top:26px;
}

.header .wrap .img_1 {
   left:0;
}

.header .wrap .img_2 {
   right:0;
}
</style> 
 </head> 
 <body> 
  <div class="header"> 
   <div class="wrap"> 
    <span class="img_1"></span> 
    <h2>Lorem</h2> 
    <span class="img_2"></span> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials