Centering text in XHTML

Soldato
Joined
15 Jan 2004
Posts
10,206
In HTML 4.01 Transitional you can center some text (horizontally and vertically) in the middle of the page. However i'm having troubles getting it to work with XHTML, if it's possible.

Code:
...
<style type="text/css">
#moo { width: 100%; height: 100%; }
</style>
</head>
<body>
<table id="moo">
<tr>
<td align="center">
Hello, this should be in the middle of the page.
</td>
</tr>
</table>
...

If I change the !DOCTYPE to HTML 4.01 Transitional, then the text becomes centered. But when I change the !DOCTYPE back to XHTML 1.1 then the text stays at the top of the page.

Suggestions?
 
Last edited:
Ok then...


I need an image along the top of the page that repeats across the screen.

I also need an image doing the same along the bottom of the page.

So i've used a table and 3 cells to achieve this. However when I check the XHTML at w3 it says it's invalid. Because of course i've use the height: 100%.

I could use divs like shown above but how would I repeat the image using divs?
 
Back
Top Bottom