HTML CSS examples for CSS Layout:Relative Position
Absolute positioned element inside centered relatively positioned div
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> body, html { height:100%; margin:0; padding:0; } </style> <!-- ww w .j ava 2 s . c om--> </head> <body> <div style="position:relative; height: 100%; background: #eee;"> <div> <img style="position: absolute; left:0; right:0; top:0; bottom:0; margin: auto;" src="https://www.java2s.com/style/demo/InternetExplorer.png"> </div> </div> </body> </html>