HTML CSS examples for CSS Layout:Position
use CSS to position a div in the middle of the page while support a dynamic width
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #header {<!--from www .ja v a2s. com--> background:black; height:41px; width:100%; position:absolute; top:0; left:0; } #headerBanner { text-align:center; width:100%; position:absolute; top:41px; z-index:3; height:0; } #headerBanner>div { background:red; display:inline-block; *display:inline; zoom:2; } #contentbody { position:absolute; top:41px; background:yellow; height:301px; min-height:301px; width:100%; } </style> </head> <body> <div id="header"> Lorem ip </div> <div id="headerBanner"> <div> Lorem ipsum dolor sit amet, consectetur adipi </div> </div> <div id="contentbody"> </div> </body> </html>