How do I align div tags down the center of a page using CSS? My divs look like this: <div id="main"> <div id="header"> code... </div> <div id="content"> code... </div> <div id="footer"> code... </div> </div> Code (markup):
Try this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <style type="text/css"> #content { position:absolute; top:50%; height:10em; } </style> </head> <body> <div id="content"> sdf </div> </body> </html> if you have any more questions hit me up on twitter @danramosd
If you want all your divs to be centered then do this #main{ width:960px; margin:0 auto; } you can set whatever width you want.