HTML CSS examples for CSS Layout:Position
positioning a div based upon percentages with CSS
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #block {<!--from w ww. j av a2s . co m--> background-color:Chartreuse; height:100px; width:100px; position:absolute; left:51%; top:51%; transform:translate(51%, 51%); } </style> </head> <body> <div id="block"></div> </body> </html>