Given a div with known dimensions, say width: 300px; height: 200px, what is the easiest method to place it in the middle of the screen both vertically and horizontally ? Example here
I’m interested in latest Firefox (no need for IE hacks).
CSS only please, no Javascript.
Position it 50% from the window/parent container and use a negative margin size that’s half of the elements width/height 🙂
You might need to set
height: 100%, on both thebodyandhtmlEdit: Here’s a working example .