To have it center in the browser, regardless of the page scroll (which is probably what you want), position: fixed will be more reliable. Amending mike108's code:
<style type="text/css">
.centered {
position:fixed;
z-index: 100;
top:50%;
left:50%;
margin:-100px 0 0 -100px;
width:200px;
height:200px;
}
</style>
This assumes you have a fixed size box you are showing. If you don't have a fixed size box, you'll need to use Javascript to measure the window and the div and position it explicitly (again, fixed is probably the way to go).
Do test on all your browsers, though. There may be something we're not thinking of.
I'd actually recommend you look at one of the Javascript plugins that does this, at least for a starting point. They have figured it out, even if you don't want to use their code. I think I used jqModal as a starting point.