HTML - vertically align a table to centre of screen
#1
HTML - vertically align a table to centre of screen
Which style sheet element do you modify to verticlly align a table to the centre of the browser window ?
I know IE will accept it if you cheat like this (but its not compliant code):
<table width=100% height="*">
<tr> <td> table 1 </td> </tr>
</table>
<table width=100% height=400>
<tr> <td> table 2 </td> </tr>
</table>
<table width=100% height="*">
<tr> <td> table 3 </td> </tr>
</table>
I want a universal method which means altering the style sheet, so that it works in all compliant browsers. Which element do I change ?
eg. if I do this in a style sheet it DOESN'T WORK:
table.top {
height: 25%;
}
table.middle {
height: 50%;
}
table.bottom {
height: 25%;
}
I know IE will accept it if you cheat like this (but its not compliant code):
<table width=100% height="*">
<tr> <td> table 1 </td> </tr>
</table>
<table width=100% height=400>
<tr> <td> table 2 </td> </tr>
</table>
<table width=100% height="*">
<tr> <td> table 3 </td> </tr>
</table>
I want a universal method which means altering the style sheet, so that it works in all compliant browsers. Which element do I change ?
eg. if I do this in a style sheet it DOESN'T WORK:
table.top {
height: 25%;
}
table.middle {
height: 50%;
}
table.bottom {
height: 25%;
}
Last edited by Fuchsrohre; 21 February 2005 at 09:58 PM.
#2
ok, I've checked this out and it turns out y code is correct and the table is actually setting itself correctly - however the table is constrained by whatever setting the BODY and HTML tags have been set to.
Adding the following to the style sheet did the trick
html, body {
height: 100%;
}
Adding the following to the style sheet did the trick
html, body {
height: 100%;
}
Thread
Thread Starter
Forum
Replies
Last Post
Scott@ScoobySpares
Full Cars Breaking For Spares
55
05 August 2018 07:02 AM
shorty87
Full Cars Breaking For Spares
19
22 December 2015 11:59 AM
shorty87
Wheels And Tyres For Sale
0
25 September 2015 08:36 PM