Vertical centering with transform - HTML CSS CSS Animation

HTML CSS examples for CSS Animation:Transform

Description

Vertical centering with transform

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">
.background-image {
   background-image:url('https://www.java2s.com/style/demo/Google-Chrome.png');
   height:601px;
   background-size:contain;
   position:relative;
   background-position:center;
   background-repeat:no-repeat;
   margin:0 auto;
   text-align:center;
}

.omg-title {<!--  w w w  .  j  a v a  2 s  . c om-->
   top:51%;
   position:absolute;
   margin-top:-11px;
   text-align:center;
   width:100%;
}
</style> 
 </head> 
 <body> 
  <div class="background-image"> 
   <div class="omg-title">
     Lorem ipsum dolor s 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials