Can someone please show me the errror of my ways and explain why I get different results from the following css:
1.
CODE
...
<head>
...
</head>
<body>
<table style="width: 100%; height: 100%; text-align: center; vertical-align: center">
...
</body>
<head>
...
</head>
<body>
<table style="width: 100%; height: 100%; text-align: center; vertical-align: center">
...
</body>
2.
CODE
...
<head>
...
<style type="text/css"><!--
table.layout { width: 100%; height: 100%; text-align: center; vertical-align: center; }
--></style>
</head>
<body>
<table class="layout">
...
</body>
<head>
...
<style type="text/css"><!--
table.layout { width: 100%; height: 100%; text-align: center; vertical-align: center; }
--></style>
</head>
<body>
<table class="layout">
...
</body>
I have a simple table, size 770px by 500px, which I have enclosed in the above in order to keep it in the centre of the screen. With the in-line style no.1, in IE7, the table correctly positions its contents horizontally and vertically centre of the screen, but when changed to the embedded style in no.2, the contents stay vertically centre but shift horizontally to the left of the screen. I have found a work-around by adding styles to the inner cell, but feel this should be unnecessary.
As an add-on to this question, Firefox takes no notice of the vertical-align property. Is there a way round this?
