HTML CSS examples for CSS Layout:Absolute Position
Centered horizontally via position absolute
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #header {<!-- w ww .jav a2 s. co m--> height:100px; background:blue; } #main { width:501px; background:yellow; margin:0 auto; } #footer { height:100px; background:green; } </style> </head> <body> <div id="header"> </div> <div id="main"> Lorem ipsum dolor sit <br> <br>Lorem ipsum dolor sit amet <br> <br>Lorem </div> <div id="footer"> </div> </body> </html>