Click to See Complete Forum and Search --> : Center div blocks


mediaprofil
01-26-2003, 11:00 AM
I found a way with javascript to position the blocks to have my 800 pixels content centered in the screen using document.getElementById("imagetop").style.left and document.all.imagetop.style.left, but when the conexion is slow, the menu is centered first and the main block next, even if the line of script for the main block comes first. This doesn't look nice. How can I position the main block first.

Stefan
01-27-2003, 01:38 AM
Originally posted by mediaprofil
I found a way with javascript to position the blocks to have my 800 pixels content centered in the screen using document.getElementById("imagetop").style.left and document.all.imagetop.style.left, but when the conexion is slow, the menu is centered first and the main block next, even if the line of script for the main block comes first. This doesn't look nice. How can I position the main block first.

Why not just

<body style="text-align:center">

<div style="width:800px; margin:0 auto;">This will be centered</div>



The text-align stuff in the body is to work around an IE/Win bug (most other browsers correctly center the div with auto margins, even IE 5 on Mac..., which makes you wonder why MS havn't managed to fix this bug in the last 5 years on windows.)