I am having a problem where I position a dialog with “position:absolute” and it works fine putting it in the center of the screen. But then I switch “position:absolute” with “position:fixed” after that and it causes the position to not be in the center. (I’m using latest stable Google Chrome I have.)
What’s the trick so that when I make this switch, it will always be in the center?
You need to use these styles to make it appear dead-center:
So
positionshould be specified. Thetopandleftshould be50%. Themargin-leftandmargin-topshould be negative one half of the width and height of the box respectively.Notice that
position:fixeddoes not work in IE6.