Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertically And Horizonatally center main wrap div [duplicate]

Tags:

Possible Duplicate:
How to center DIV in DIV?

Now i try

<html> <head>          <title>?????????????????</title>         <style type="text/css">        body     {              margin-left: auto;             margin-right:auto;     }      #wrap     {             background: black;             margin-left: auto;             margin-right:auto;             height:450px;             width:450px;             position:absolute;             top:50%;             right:50%;             left:50%;             margin-top:-225px;          }     </style> </head> <body>         <div id="wrap">                 Hello         </div> </body> </html> 

?????

like image 425
John Nall Avatar asked May 12 '10 21:05

John Nall


1 Answers

vertical-align does not work the way most beginners expect it to work.

Here is one tutorial explaining the situation. It sounds like you want Method 1.

like image 91
Jon Purdy Avatar answered Oct 24 '22 15:10

Jon Purdy