![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Then you are screwed. Standards mode does not centre "vertically". |
|
You are solving the wrong problem. You should be looking into why you need to centre a "page" vertically. Vertically in what? The current viewport? Why? What does this gain your viewer? |
|
Invoking quirks mode in the couple of browsers that support it is not the solution. |
#4
| |||
| |||
|
| http://auriance.com/docs/tmp/notcenter.html [...] Ok, I actually can achieve it in standard mode but only stuffing the code with javascript and lately I have dropped it, I'm using quirks mode with less code. If you have another suggestion, please let me know. |
#5
| |||
| |||
|
|
... centered vertically and horizontally in the browser. I can achieve it in quirks mode: http://auriance.com/docs/tmp/notcenter.html If I add the doctype, I'm in standard mode and it doesn't work anymore: http://auriance.com/docs/tmp/notcenter.html |
#6
| |||
| |||
|
|
Well, this should work in strict mode in Firefox, Opera and Konqueror: html, body { margin: 0; padding: 0; height: 100%; /* I suspect this is what quirks mode is giving you in this case */ } table { width: 100%; height: 100%; } td { /* These are preferable to align="center" */ vertical-align: middle; text-align: center; } body table tr td>Centre of screen</td /tr /table /body |
#7
| |||
| |||
|
|
On Oct 26, 5:54 pm, Ben C <spams... (AT) spam (DOT) eggs> wrote: [...] Thanks, indeed, it's working fine: http://auriance.com/docs/tmp/xhtml.html I could remove safely "padding: 0;" from html, body, it's still working fine. |
|
What I don't understand is that the browsers consider the viewport is all the window and not the content (just one line). What do you think? |
#8
| |||
| |||
|
|
Most browsers have a bit of margin on body by default, but some may use padding instead, so it's safer to set both to 0. The idea is to make sure that body's content area is exactly the same as the viewport, no smaller, or you'll end up with an annoying short scroll bar. |
|
That's just what the viewport is defined as. Its dimensions are whatever the user sized the window to. |

#9
| |||
| |||
|
|
Well, this should work in strict mode in Firefox, Opera and Konqueror: html, body { margin: 0; padding: 0; height: 100%; /* I suspect this is what quirks mode is giving you in this case */ } table { width: 100%; height: 100%; } td { /* These are preferable to align="center" */ vertical-align: middle; text-align: center; } body table tr td>Centre of screen</td /tr /table /body |
#10
| |||
| |||
|
|
On Oct 26, 5:54 pm, Ben C <spams... (AT) spam (DOT) eggs> wrote: Well, this should work in strict mode in Firefox, Opera and Konqueror: html, body { margin: 0; padding: 0; height: 100%; /* I suspect this is what quirks mode is giving you in this case */ } table { width: 100%; height: 100%; } td { /* These are preferable to align="center" */ vertical-align: middle; text-align: center; } body table tr td>Centre of screen</td /tr /table /body Hello guys, Me again :-) The above doesn't work with a division, does it? http://auriance.com/docs/tmp/xhtml.div.html |
![]() |
| Thread Tools | |
| Display Modes | |
| |