HTML CSS examples for CSS Animation:Transform
Vertical centering with transform
<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>