centered div web layout

prefektas

New Member
I don't have much HTML/CSS experience, but I am trying to get a simple layout going where I have a centered div acting as the page container. I have tried looking up other examples, but I can't figure out why mine doesn't work (the header appears but is left justified, I want it centered):html:\[code\]<!DOCTYPE html><html><head> <title>title</title> <script type="text/javascript" src="http://stackoverflow.com/questions/14602290/script.js"></script> <link rel="stylesheet" type="text/css" href="http://stackoverflow.com/questions/14602290/style.css"></head><body> <div id="container"> <div id="header"></div> </div></body></html>\[/code\]css:\[code\]body { background: #fff; font-family: Helvetica, Arial, sans-serif; margin: 0; padding: 0; text-align: center;}#container { background: #bbb; width: 800px; margin: 0, auto;}#header, #footer { background: #333; height: 40px;}\[/code\]
 
Back
Top