I'm just starting
Java, but have been playing with HTML and CSS for a few years.
To centre a design do the following:
If you paste that into a text editor and save as "index.html" you will see that the page is centred (centered for those on the other side of the
pond).
I have added a black background to the body and a white background to the container div.
I have used HTML5, but you can use any DOCTYPE you like.
The other method you can use is positioning and negative margins.
Create a positioning context. { position : relative; }
Set left 50% to put the left hand edge of your container div in the center of the page. { left : 50%; }
Pull the container back half the container width by using negative margins. { margin-left : -480px; }
// 960px / 2 = 480px
Obviously rather than putting the CSS in the head, you'd ideally want to place it in an external css file and link to it.
Hope this helps.